Modernise urlconf

This commit is contained in:
Anna Sidwell 2019-08-20 00:51:44 +02:00
parent 03eecf6461
commit 06d138343e

View File

@ -1,4 +1,4 @@
from django.conf.urls import url
from django.urls import path
from django.urls import reverse_lazy
from django.views.generic import RedirectView
from django.views.i18n import JavaScriptCatalog
@ -6,47 +6,35 @@ from django.views.i18n import JavaScriptCatalog
from . import views
urlpatterns = [
url(r"^$", RedirectView.as_view(url=reverse_lazy("map")), name="index"),
url(
r"^case-study/create/?$", views.CreateCaseStudySelector.as_view(), name="create"
),
url(
r"^case-study/create/short/?$",
path("", RedirectView.as_view(url=reverse_lazy("map")), name="index"),
path("map", views.Map.as_view(), name="map"),
path("case-study/create", views.CreateCaseStudySelector.as_view(), name="create"),
path(
"case-study/create/short",
views.CreateShortCaseStudy.as_view(),
name="short-form",
),
url(
r"^case-study/create/long/?$",
views.CreateLongCaseStudy.as_view(),
name="long-form",
path(
"case-study/create/long", views.CreateLongCaseStudy.as_view(), name="long-form"
),
url(
r"^case-study/create/poi/?$",
path(
"case-study/create/poi",
views.CreatePointOfInterest.as_view(),
name="point-of-interest-form",
),
url(
r"^case-study/create/success/?$",
path(
"case-study/create/success",
views.CreateCaseStudySuccess.as_view(),
name="form-success",
),
url(
r"^case-study/edit/(?P<pk>[\d]+)/?$", views.EditCaseStudy.as_view(), name="edit"
),
# Case study drafts
url(r"^case-study/draft/?$", views.DraftsAPI.as_view(), name="drafts"),
# View case studies
path("case-study/edit/<int:pk>", views.EditCaseStudy.as_view(), name="edit"),
path("case-study/draft", views.DraftsAPI.as_view(), name="drafts"),
# This should be last so that the above options will be tried first!
url(
r"^case-study/(?P<slug>[-\w]+)/?$",
views.ViewCaseStudyDetail.as_view(),
name="detail",
),
url(r"^map/?$", views.Map.as_view(), name="map"),
path("case-study/<slug:slug>", views.ViewCaseStudyDetail.as_view(), name="detail"),
# API
url(r"^jsi18n/$", JavaScriptCatalog.as_view(), name="javascript-catalogue"),
url(
r"^srs-autocomplete/$",
path("jsi18n", JavaScriptCatalog.as_view(), name="javascript-catalogue"),
path(
"srs-autocomplete",
views.SpatialRefSysAutocomplete.as_view(),
name="srs-autocomplete",
),