Skip to content

Commit 7b18370

Browse files
committed
Make entire version create url conditional
1 parent 0fe01f6 commit 7b18370

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

readthedocs/projects/urls/private.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Project URLs for authenticated users."""
22

3+
from django.conf import settings
34
from django.conf.urls import url
45
from django.contrib.auth.decorators import login_required
56
from django.views.generic.base import RedirectView
@@ -82,11 +83,6 @@
8283
ProjectVersionDeleteHTML.as_view(),
8384
name='project_version_delete_html',
8485
),
85-
url(
86-
r'^(?P<project_slug>[-\w]+)/version/create/$',
87-
ProjectVersionCreate.as_view(),
88-
name='project_version_create',
89-
),
9086
url(
9187
r'^(?P<project_slug>[-\w]+)/version/(?P<version_slug>[^/]+)/edit/$',
9288
ProjectVersionDetail.as_view(),
@@ -152,6 +148,18 @@
152148
),
153149
]
154150

151+
# TODO move this up to the list above when it's not a conditional URL.
152+
# Currently, this is only used by the new theme, we don't allow for "create" in
153+
# our current templates.
154+
if settings.RTD_EXT_THEME_ENABLED:
155+
urlpatterns.append(
156+
url(
157+
r'^(?P<project_slug>[-\w]+)/version/create/$',
158+
ProjectVersionCreate.as_view(),
159+
name='project_version_create',
160+
),
161+
)
162+
155163
domain_urls = [
156164
url(
157165
r'^(?P<project_slug>[-\w]+)/domains/$',

readthedocs/templates/projects/project_version_submit.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
<p>
44
<input style="display: inline;" type="submit" value="{% trans "Save" %}">
5-
{% if version %}
6-
{% trans "or" %}
7-
<a href="{% url "wipe_version" version.project.slug version.slug %}">{% trans "wipe "%}</a>
8-
{% endif %}
5+
{% trans "or" %}
6+
<a href="{% url "wipe_version" version.project.slug version.slug %}">{% trans "wipe "%}</a>
97
</p>

0 commit comments

Comments
 (0)