chore: use path rather than re_path in urls.py

This commit is contained in:
Alexis Métaireau 2024-02-22 15:08:13 +01:00
parent 1415f96c6f
commit d18a32b5d3

View file

@ -21,8 +21,6 @@ from .utils import decorated_patterns
admin.autodiscover()
uuid = r"[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"
urlpatterns = [
re_path(r"^admin/", admin.site.urls),
re_path("", include("social_django.urls", namespace="social")),
@ -74,18 +72,18 @@ i18n_urls = [
]
i18n_urls += decorated_patterns(
[can_view_map, cache_control(must_revalidate=True)],
re_path(
r"^datalayer/(?P<map_id>\d+)/(?P<pk>" + uuid + ")/$",
path(
"datalayer/<int:map_id>/<uuid:pk>/",
views.DataLayerView.as_view(),
name="datalayer_view",
),
re_path(
r"^datalayer/(?P<map_id>\d+)/(?P<pk>" + uuid + r")/versions/$",
path(
"datalayer/<int:map_id>/<uuid:pk>/versions/",
views.DataLayerVersions.as_view(),
name="datalayer_versions",
),
re_path(
r"^datalayer/(?P<map_id>\d+)/(?P<pk>" + uuid + r")/(?P<name>" + uuid + r"[_\w]+.geojson)$",
path(
"datalayer/<int:map_id>/<uuid:pk>/<str:name>",
views.DataLayerVersion.as_view(),
name="datalayer_version",
),
@ -147,13 +145,13 @@ map_urls = [
views.DataLayerCreate.as_view(),
name="datalayer_create",
),
re_path(
r"^map/(?P<map_id>[\d]+)/datalayer/delete/(?P<pk>" + uuid + r")/$",
path(
"map/<int:map_id>/datalayer/delete/<uuid:pk>/",
views.DataLayerDelete.as_view(),
name="datalayer_delete",
),
re_path(
r"^map/(?P<map_id>[\d]+)/datalayer/permissions/(?P<pk>" + uuid + r"\d+)/$",
path(
"map/<int:map_id>/datalayer/permissions/<uuid:pk>/",
views.UpdateDataLayerPermissions.as_view(),
name="datalayer_permissions",
),
@ -167,8 +165,7 @@ if settings.DEFAULT_FROM_EMAIL:
)
)
datalayer_urls = [
re_path(
r"^map/(?P<map_id>[\d]+)/datalayer/update/(?P<pk>" + uuid + r")/$",
path("map/<int:map_id>/datalayer/update/<uuid:pk>/",
views.DataLayerUpdate.as_view(),
name="datalayer_update",
),