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