0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Replace a few instances of re_path with path

This commit is contained in:
Storm Heg 2020-02-20 16:39:03 +00:00 committed by Matt Westcott
parent 4076b9ef5e
commit 98c66359a8
24 changed files with 115 additions and 113 deletions

View File

@ -140,10 +140,10 @@ URL Patterns
from wagtail.documents import urls as wagtaildocs_urls
urlpatterns = [
re_path(r'^django-admin/', include(admin.site.urls)),
path('django-admin/', admin.site.urls),
re_path(r'^admin/', include(wagtailadmin_urls)),
re_path(r'^documents/', include(wagtaildocs_urls)),
path('admin/', include(wagtailadmin_urls)),
path('documents/', include(wagtaildocs_urls)),
# Optional URL for including your own vanilla Django urls/views
re_path(r'', include('myapp.urls')),
@ -368,7 +368,7 @@ These two files should reside in your project directory (``myproject/myproject/`
.. code-block:: python
from django.urls import include, re_path
from django.urls import include, path, re_path
from django.conf.urls.static import static
from django.views.generic.base import RedirectView
from django.contrib import admin
@ -381,10 +381,10 @@ These two files should reside in your project directory (``myproject/myproject/`
urlpatterns = [
re_path(r'^django-admin/', include(admin.site.urls)),
path('django-admin/', admin.site.urls),
re_path(r'^admin/', include(wagtailadmin_urls)),
re_path(r'^documents/', include(wagtaildocs_urls)),
path('admin/', include(wagtailadmin_urls)),
path('documents/', include(wagtaildocs_urls)),
# For anything not caught by a more specific rule above, hand over to
# Wagtail's serving mechanism
@ -398,5 +398,5 @@ These two files should reside in your project directory (``myproject/myproject/`
urlpatterns += staticfiles_urlpatterns() # tell gunicorn where static files are in dev mode
urlpatterns += static(settings.MEDIA_URL + 'images/', document_root=os.path.join(settings.MEDIA_ROOT, 'images'))
urlpatterns += [
re_path(r'^favicon\.ico$', RedirectView.as_view(url=settings.STATIC_URL + 'myapp/images/favicon.ico'))
path('favicon.ico', RedirectView.as_view(url=settings.STATIC_URL + 'myapp/images/favicon.ico'))
]

View File

@ -77,9 +77,9 @@ Now make the following additions to your ``urls.py`` file:
urlpatterns = [
...
re_path(r'^cms/', include(wagtailadmin_urls)),
re_path(r'^documents/', include(wagtaildocs_urls)),
re_path(r'^pages/', include(wagtail_urls)),
path('cms/', include(wagtailadmin_urls)),
path('documents/', include(wagtaildocs_urls)),
path('pages/', include(wagtail_urls)),
...
]

View File

@ -28,13 +28,13 @@ urlpatterns = [
# TODO: Move into wagtailadmin_pages namespace
path('pages/', pages.index, name='wagtailadmin_explore_root'),
re_path(r'^pages/(\d+)/$', pages.index, name='wagtailadmin_explore'),
path('pages/<int:parent_page_id>/', pages.index, name='wagtailadmin_explore'),
path('pages/', include(wagtailadmin_pages_urls, namespace='wagtailadmin_pages')),
# TODO: Move into wagtailadmin_pages namespace
path('choose-page/', chooser.browse, name='wagtailadmin_choose_page'),
re_path(r'^choose-page/(\d+)/$', chooser.browse, name='wagtailadmin_choose_page_child'),
path('choose-page/<int:parent_page_id>/', chooser.browse, name='wagtailadmin_choose_page_child'),
path('choose-page/search/', chooser.search, name='wagtailadmin_choose_page_search'),
path('choose-external-link/', chooser.external_link, name='wagtailadmin_choose_page_external_link'),
path('choose-email-link/', chooser.email_link, name='wagtailadmin_choose_page_email_link'),
@ -42,7 +42,7 @@ urlpatterns = [
path('choose-anchor-link/', chooser.anchor_link, name='wagtailadmin_choose_page_anchor_link'),
path('tag-autocomplete/', tags.autocomplete, name='wagtailadmin_tag_autocomplete'),
re_path(r'^tag-autocomplete/(\w+)/(\w+)/$', tags.autocomplete, name='wagtailadmin_tag_model_autocomplete'),
path('tag-autocomplete/<slug:app_name>/<slug:model_name>/', tags.autocomplete, name='wagtailadmin_tag_model_autocomplete'),
path('collections/', include(wagtailadmin_collections_urls, namespace='wagtailadmin_collections')),
@ -89,8 +89,8 @@ urlpatterns += [
# These two URLs have the "permission_required" decorator applied directly
# as they need to fail with a 403 error rather than redirect to the login page
re_path(r'^userbar/(\d+)/$', userbar.for_frontend, name='wagtailadmin_userbar_frontend'),
re_path(r'^userbar/moderation/(\d+)/$', userbar.for_moderation, name='wagtailadmin_userbar_moderation'),
path('userbar/<int:page_id>/', userbar.for_frontend, name='wagtailadmin_userbar_frontend'),
path('userbar/moderation/<int:revision_id>/', userbar.for_moderation, name='wagtailadmin_userbar_moderation'),
# Password reset
path('password_reset/', include(wagtailadmin_password_reset_urls)),

View File

@ -1,4 +1,4 @@
from django.urls import path, re_path
from django.urls import path
from wagtail.admin.views import collection_privacy, collections
@ -6,7 +6,7 @@ app_name = 'wagtailadmin_collections'
urlpatterns = [
path('', collections.Index.as_view(), name='index'),
path('add/', collections.Create.as_view(), name='add'),
re_path(r'^(\d+)/$', collections.Edit.as_view(), name='edit'),
re_path(r'^(\d+)/delete/$', collections.Delete.as_view(), name='delete'),
re_path(r'^(\d+)/privacy/$', collection_privacy.set_privacy, name='set_privacy'),
path('<int:pk>/', collections.Edit.as_view(), name='edit'),
path('<int:pk>/delete/', collections.Delete.as_view(), name='delete'),
path('<int:collection_id>/privacy/', collection_privacy.set_privacy, name='set_privacy'),
]

View File

@ -1,42 +1,42 @@
from django.urls import re_path
from django.urls import path, re_path
from wagtail.admin.views import page_privacy, pages
app_name = 'wagtailadmin_pages'
urlpatterns = [
re_path(r'^add/(\w+)/(\w+)/(\d+)/$', pages.create, name='add'),
re_path(r'^add/(\w+)/(\w+)/(\d+)/preview/$', pages.PreviewOnCreate.as_view(), name='preview_on_add'),
re_path(r'^usage/(\w+)/(\w+)/$', pages.content_type_use, name='type_use'),
path('add/<slug:content_type_app_name>/<slug:content_type_model_name>/<int:parent_page_id>/', pages.create, name='add'),
path('add/<slug:content_type_app_name>/<slug:content_type_model_name>/<int:parent_page_id>/preview/', pages.PreviewOnCreate.as_view(), name='preview_on_add'),
path('usage/<slug:content_type_app_name>/<slug:content_type_model_name>/', pages.content_type_use, name='type_use'),
re_path(r'^(\d+)/edit/$', pages.edit, name='edit'),
re_path(r'^(\d+)/edit/preview/$', pages.PreviewOnEdit.as_view(), name='preview_on_edit'),
path('<int:page_id>/edit/', pages.edit, name='edit'),
path('<int:page_id>/edit/preview/', pages.PreviewOnEdit.as_view(), name='preview_on_edit'),
re_path(r'^(\d+)/view_draft/$', pages.view_draft, name='view_draft'),
re_path(r'^(\d+)/add_subpage/$', pages.add_subpage, name='add_subpage'),
re_path(r'^(\d+)/delete/$', pages.delete, name='delete'),
re_path(r'^(\d+)/unpublish/$', pages.unpublish, name='unpublish'),
path('<int:page_id>/view_draft/', pages.view_draft, name='view_draft'),
path('<int:parent_page_id>/add_subpage/', pages.add_subpage, name='add_subpage'),
path('<int:page_id>/delete/', pages.delete, name='delete'),
path('<int:page_id>/unpublish/', pages.unpublish, name='unpublish'),
re_path(r'^search/$', pages.search, name='search'),
path('search/', pages.search, name='search'),
re_path(r'^(\d+)/move/$', pages.move_choose_destination, name='move'),
re_path(r'^(\d+)/move/(\d+)/$', pages.move_choose_destination, name='move_choose_destination'),
re_path(r'^(\d+)/move/(\d+)/confirm/$', pages.move_confirm, name='move_confirm'),
re_path(r'^(\d+)/set_position/$', pages.set_page_position, name='set_page_position'),
path('<int:page_to_move_id>/move/', pages.move_choose_destination, name='move'),
path('<int:page_to_move_id>/move/<int:viewed_page_id>/', pages.move_choose_destination, name='move_choose_destination'),
path('<int:page_to_move_id>/move/<int:destination_id>/confirm/', pages.move_confirm, name='move_confirm'),
path('<int:page_to_move_id>/set_position/', pages.set_page_position, name='set_page_position'),
re_path(r'^(\d+)/copy/$', pages.copy, name='copy'),
path('<int:page_id>/copy/', pages.copy, name='copy'),
re_path(r'^moderation/(\d+)/approve/$', pages.approve_moderation, name='approve_moderation'),
re_path(r'^moderation/(\d+)/reject/$', pages.reject_moderation, name='reject_moderation'),
re_path(r'^moderation/(\d+)/preview/$', pages.preview_for_moderation, name='preview_for_moderation'),
path('moderation/<int:revision_id>/approve/', pages.approve_moderation, name='approve_moderation'),
path('moderation/<int:revision_id>/reject/', pages.reject_moderation, name='reject_moderation'),
path('moderation/<int:revision_id>/preview/', pages.preview_for_moderation, name='preview_for_moderation'),
re_path(r'^(\d+)/privacy/$', page_privacy.set_privacy, name='set_privacy'),
path('<int:page_id>/privacy/', page_privacy.set_privacy, name='set_privacy'),
re_path(r'^(\d+)/lock/$', pages.lock, name='lock'),
re_path(r'^(\d+)/unlock/$', pages.unlock, name='unlock'),
path('<int:page_id>/lock/', pages.lock, name='lock'),
path('<int:page_id>/unlock/', pages.unlock, name='unlock'),
re_path(r'^(\d+)/revisions/$', pages.revisions_index, name='revisions_index'),
re_path(r'^(\d+)/revisions/(\d+)/view/$', pages.revisions_view, name='revisions_view'),
re_path(r'^(\d+)/revisions/(\d+)/revert/$', pages.revisions_revert, name='revisions_revert'),
re_path(r'^(\d+)/revisions/(\d+)/unschedule/$', pages.revisions_unschedule, name='revisions_unschedule'),
path('<int:page_id>/revisions/', pages.revisions_index, name='revisions_index'),
path('<int:page_id>/revisions/<int:revision_id>/view/', pages.revisions_view, name='revisions_view'),
path('<int:page_id>/revisions/<int:revision_id>/revert/', pages.revisions_revert, name='revisions_revert'),
path('<int:page_id>/revisions/<int:revision_id>/unschedule/', pages.revisions_unschedule, name='revisions_unschedule'),
re_path(r'^(\d+)/revisions/compare/(live|earliest|\d+)\.\.\.(live|latest|\d+)/$', pages.revisions_compare, name='revisions_compare'),
]

View File

@ -100,8 +100,8 @@ class Delete(DeleteView):
return context
def post(self, request, instance_id):
self.object = get_object_or_404(self.get_queryset(), id=instance_id)
def post(self, request, pk):
self.object = get_object_or_404(self.get_queryset(), id=pk)
collection_contents = self.get_collection_contents()
if collection_contents:

View File

@ -665,7 +665,7 @@ class PreviewOnEdit(View):
def get_page(self):
return get_object_or_404(Page,
id=self.args[0]).get_latest_revision_as_page()
id=self.kwargs["page_id"]).get_latest_revision_as_page()
def get_form(self, page, query_dict):
form_class = page.get_edit_handler().get_form_class()
@ -714,8 +714,9 @@ class PreviewOnEdit(View):
class PreviewOnCreate(PreviewOnEdit):
def get_page(self):
(content_type_app_name, content_type_model_name,
parent_page_id) = self.args
content_type_app_name = self.kwargs["content_type_app_name"]
content_type_model_name = self.kwargs["content_type_model_name"]
parent_page_id = self.kwargs["parent_page_id"]
try:
content_type = ContentType.objects.get_by_natural_key(
content_type_app_name, content_type_model_name)

View File

@ -1,6 +1,6 @@
from django.core.exceptions import ImproperlyConfigured
from django.forms.models import modelform_factory
from django.urls import path, re_path
from django.urls import path
from wagtail.admin.views import generic
from wagtail.core.permissions import ModelPermissionPolicy
@ -89,6 +89,6 @@ class ModelViewSet(ViewSet):
return super().get_urlpatterns() + [
path('', self.index_view, name='index'),
path('new/', self.add_view, name='add'),
re_path(r'^(\d+)/$', self.edit_view, name='edit'),
re_path(r'^(\d+)/delete/$', self.delete_view, name='delete'),
path('<int:pk>/', self.edit_view, name='edit'),
path('<int:pk>delete/', self.delete_view, name='delete'),
]

View File

@ -3,7 +3,7 @@ from collections import OrderedDict
from django.core.exceptions import FieldDoesNotExist
from django.http import Http404
from django.shortcuts import redirect
from django.urls import path, re_path, reverse
from django.urls import path, reverse
from modelcluster.fields import ParentalKey
from rest_framework import status
from rest_framework.renderers import BrowsableAPIRenderer, JSONRenderer
@ -336,7 +336,7 @@ class BaseAPIViewSet(GenericViewSet):
"""
return [
path('', cls.as_view({'get': 'listing_view'}), name='listing'),
re_path(r'^(?P<pk>\d+)/$', cls.as_view({'get': 'detail_view'}), name='detail'),
path('<int:pk>/', cls.as_view({'get': 'detail_view'}), name='detail'),
path('find/', cls.as_view({'get': 'find_view'}), name='find'),
]

View File

@ -1,4 +1,4 @@
from django.urls import path, re_path
from django.urls import path
from wagtail.contrib.forms.views import (
DeleteSubmissionsView, FormPagesListView, get_submissions_list_view)
@ -6,6 +6,6 @@ from wagtail.contrib.forms.views import (
app_name = 'wagtailforms'
urlpatterns = [
path('', FormPagesListView.as_view(), name='index'),
re_path(r'^submissions/(?P<page_id>\d+)/$', get_submissions_list_view, name='list_submissions'),
re_path(r'^submissions/(?P<page_id>\d+)/delete/$', DeleteSubmissionsView.as_view(), name='delete_submissions')
path('submissions/<int:page_id>/', get_submissions_list_view, name='list_submissions'),
path('submissions/<int:page_id>/delete/', DeleteSubmissionsView.as_view(), name='delete_submissions')
]

View File

@ -1,4 +1,4 @@
from django.urls import path, re_path
from django.urls import path
from wagtail.contrib.redirects import views
@ -6,8 +6,8 @@ app_name = 'wagtailredirects'
urlpatterns = [
path('', views.index, name='index'),
path('add/', views.add, name='add'),
re_path(r'^(\d+)/$', views.edit, name='edit'),
re_path(r'^(\d+)/delete/$', views.delete, name='delete'),
re_path(r"^import/$", views.start_import, name="start_import"),
re_path(r"^import/process/$", views.process_import, name="process_import"),
path('<int:redirect_id>/', views.edit, name='edit'),
path('<int:redirect_id>/delete/', views.delete, name='delete'),
path('import/', views.start_import, name="start_import"),
path('import/process/', views.process_import, name="process_import"),
]

View File

@ -1,4 +1,4 @@
from django.urls import path, re_path
from django.urls import path
from wagtail.contrib.search_promotions import views
@ -6,6 +6,6 @@ app_name = 'wagtailsearchpromotions'
urlpatterns = [
path('', views.index, name='index'),
path('add/', views.add, name='add'),
re_path(r'^(\d+)/$', views.edit, name='edit'),
re_path(r'^(\d+)/delete/$', views.delete, name='delete'),
path('<int:query_id>/', views.edit, name='edit'),
path('<int:query_id>/delete/', views.delete, name='delete'),
]

View File

@ -1,9 +1,9 @@
from django.urls import re_path
from django.urls import path
from . import views
app_name = 'wagtailsettings'
urlpatterns = [
re_path(r'^(\w+)/(\w+)/$', views.edit_current_site, name='edit'),
re_path(r'^(\w+)/(\w+)/(\d+)/$', views.edit, name='edit'),
path('<slug:app_name>/<slug:model_name>/', views.edit_current_site, name='edit'),
path('<slug:app_name>/<slug:model_name>/<int:site_pk>/', views.edit, name='edit'),
]

View File

@ -23,8 +23,8 @@ WAGTAIL_FRONTEND_LOGIN_TEMPLATE = getattr(
urlpatterns = [
re_path(
r'^_util/authenticate_with_password/(\d+)/(\d+)/',
path(
'_util/authenticate_with_password/<int:page_view_restriction_id>/<int:page_id>/',
views.authenticate_with_password,
name='wagtailcore_authenticate_with_password'),
path(

View File

@ -1,4 +1,4 @@
from django.urls import path, re_path
from django.urls import path
from wagtail.documents.views import chooser, documents, multiple
@ -6,15 +6,15 @@ app_name = 'wagtaildocs'
urlpatterns = [
path('', documents.index, name='index'),
path('add/', documents.add, name='add'),
re_path(r'^edit/(\d+)/$', documents.edit, name='edit'),
re_path(r'^delete/(\d+)/$', documents.delete, name='delete'),
path('edit/<int:document_id>/', documents.edit, name='edit'),
path('delete/<int:document_id>/', documents.delete, name='delete'),
path('multiple/add/', multiple.add, name='add_multiple'),
re_path(r'^multiple/(\d+)/$', multiple.edit, name='edit_multiple'),
re_path(r'^multiple/(\d+)/delete/$', multiple.delete, name='delete_multiple'),
path('multiple/<int:doc_id>/', multiple.edit, name='edit_multiple'),
path('multiple/<int:doc_id>/delete/', multiple.delete, name='delete_multiple'),
path('chooser/', chooser.chooser, name='chooser'),
re_path(r'^chooser/(\d+)/$', chooser.document_chosen, name='document_chosen'),
path('chooser/<int:document_id>/', chooser.document_chosen, name='document_chosen'),
path('chooser/upload/', chooser.chooser_upload, name='chooser_upload'),
re_path(r'^usage/(\d+)/$', documents.usage, name='document_usage'),
path('usage/<int:document_id>/', documents.usage, name='document_usage'),
]

View File

@ -1,11 +1,11 @@
from django.urls import re_path
from django.urls import path, re_path
from wagtail.documents.views import serve
urlpatterns = [
re_path(r'^(\d+)/(.*)$', serve.serve, name='wagtaildocs_serve'),
re_path(
r'^authenticate_with_password/(\d+)/$',
path(
'authenticate_with_password/<int:restriction_id>/',
serve.authenticate_with_password,
name='wagtaildocs_authenticate_with_password'),
]

View File

@ -105,7 +105,7 @@ def edit(request, doc_id, callback=None):
raise PermissionDenied
form = DocumentMultiForm(
request.POST, request.FILES, instance=doc, prefix='doc-' + doc_id, user=request.user
request.POST, request.FILES, instance=doc, prefix='doc-%d' % doc_id, user=request.user
)
if form.is_valid():

View File

@ -1,26 +1,26 @@
from django.urls import path, re_path
from django.urls import path
from wagtail.images.views import chooser, images, multiple
app_name = 'wagtailimages'
urlpatterns = [
path('', images.index, name='index'),
re_path(r'^(\d+)/$', images.edit, name='edit'),
re_path(r'^(\d+)/delete/$', images.delete, name='delete'),
re_path(r'^(\d+)/generate_url/$', images.url_generator, name='url_generator'),
re_path(r'^(\d+)/generate_url/(.*)/$', images.generate_url, name='generate_url'),
re_path(r'^(\d+)/preview/(.*)/$', images.preview, name='preview'),
path('<int:image_id>/', images.edit, name='edit'),
path('<int:image_id>/delete/', images.delete, name='delete'),
path('<int:image_id>/generate_url/', images.url_generator, name='url_generator'),
path('<int:image_id>/generate_url/<str:filter_spec>/', images.generate_url, name='generate_url'),
path('<int:image_id>/preview/<str:filter_spec>/', images.preview, name='preview'),
path('add/', images.add, name='add'),
re_path(r'^usage/(\d+)/$', images.usage, name='image_usage'),
path('usage/<int:image_id>/', images.usage, name='image_usage'),
path('multiple/add/', multiple.add, name='add_multiple'),
re_path(r'^multiple/(\d+)/$', multiple.edit, name='edit_multiple'),
re_path(r'^multiple/create_from_uploaded_image/(\d+)/$', multiple.create_from_uploaded_image, name='create_multiple_from_uploaded_image'),
re_path(r'^multiple/(\d+)/delete/$', multiple.delete, name='delete_multiple'),
re_path(r'^multiple/delete_upload/(\d+)/$', multiple.delete_upload, name='delete_upload_multiple'),
path('multiple/<int:image_id>/', multiple.edit, name='edit_multiple'),
path('multiple/create_from_uploaded_image/<int:uploaded_image_id>/', multiple.create_from_uploaded_image, name='create_multiple_from_uploaded_image'),
path('multiple/<int:image_id>/delete/', multiple.delete, name='delete_multiple'),
path('multiple/delete_upload/<int:uploaded_image_id>/', multiple.delete_upload, name='delete_upload_multiple'),
path('chooser/', chooser.chooser, name='chooser'),
re_path(r'^chooser/(\d+)/$', chooser.image_chosen, name='image_chosen'),
path('chooser/<int:image_id>/', chooser.image_chosen, name='image_chosen'),
path('chooser/upload/', chooser.chooser_upload, name='chooser_upload'),
re_path(r'^chooser/(\d+)/select_format/$', chooser.chooser_select_format, name='chooser_select_format'),
path('chooser/<int:image_id>/select_format/', chooser.chooser_select_format, name='chooser_select_format'),
]

View File

@ -4,6 +4,7 @@ from wagtail.images.views.serve import SendFileView, ServeView
from wagtail.tests import dummy_sendfile_backend
urlpatterns = [
# Format: signature, image_id, filter_spec, filename=None
re_path(r'^actions/serve/(.*)/(\d*)/(.*)/[^/]*', ServeView.as_view(action='serve'), name='wagtailimages_serve_action_serve'),
re_path(r'^actions/redirect/(.*)/(\d*)/(.*)/[^/]*', ServeView.as_view(action='redirect'), name='wagtailimages_serve_action_redirect'),
re_path(r'^custom_key/(.*)/(\d*)/(.*)/[^/]*', ServeView.as_view(key='custom'), name='wagtailimages_serve_custom_key'),

View File

@ -147,7 +147,7 @@ def edit(request, image_id, callback=None):
raise PermissionDenied
form = ImageForm(
request.POST, request.FILES, instance=image, prefix='image-' + image_id, user=request.user
request.POST, request.FILES, instance=image, prefix='image-%d' % image_id, user=request.user
)
if form.is_valid():
@ -207,7 +207,7 @@ def create_from_uploaded_image(request, uploaded_image_id):
image = Image()
form = ImageForm(
request.POST, request.FILES, instance=image, prefix='uploaded-image-' + uploaded_image_id, user=request.user
request.POST, request.FILES, instance=image, prefix='uploaded-image-%d' % uploaded_image_id, user=request.user
)
if form.is_valid():

View File

@ -57,7 +57,7 @@ class ServeView(View):
return super(ServeView, cls).as_view(**initkwargs)
def get(self, request, signature, image_id, filter_spec):
def get(self, request, signature, image_id, filter_spec, filename=None):
if not verify_signature(signature.encode(), image_id, filter_spec, key=self.key):
raise PermissionDenied

View File

@ -1,4 +1,4 @@
from django.urls import path, re_path
from django.urls import path
from wagtail.snippets.views import chooser, snippets
@ -7,13 +7,13 @@ urlpatterns = [
path('', snippets.index, name='index'),
path('choose/', chooser.choose, name='choose_generic'),
re_path(r'^choose/(\w+)/(\w+)/$', chooser.choose, name='choose'),
re_path(r'^choose/(\w+)/(\w+)/([^/]+?)/$', chooser.chosen, name='chosen'),
path('choose/<slug:app_label>/<slug:model_name>/', chooser.choose, name='choose'),
path('choose/<slug:app_label>/<slug:model_name>/<str:pk>/', chooser.chosen, name='chosen'),
re_path(r'^(\w+)/(\w+)/$', snippets.list, name='list'),
re_path(r'^(\w+)/(\w+)/add/$', snippets.create, name='add'),
re_path(r'^(\w+)/(\w+)/([^/]+?)/$', snippets.edit, name='edit'),
re_path(r'^(\w+)/(\w+)/multiple/delete/$', snippets.delete, name='delete-multiple'),
re_path(r'^(\w+)/(\w+)/([^/]+?)/delete/$', snippets.delete, name='delete'),
re_path(r'^(\w+)/(\w+)/([^/]+?)/usage/$', snippets.usage, name='usage'),
path('<slug:app_label>/<slug:model_name>/', snippets.list, name='list'),
path('<slug:app_label>/<slug:model_name>/add/', snippets.create, name='add'),
path('<slug:app_label>/<slug:model_name>/<str:pk>/', snippets.edit, name='edit'),
path('<slug:app_label>/<slug:model_name>/multiple/delete/', snippets.delete, name='delete-multiple'),
path('<slug:app_label>/<slug:model_name>/<str:pk>/delete/', snippets.delete, name='delete'),
path('<slug:app_label>/<slug:model_name>/<str:pk>/usage/', snippets.usage, name='usage'),
]

View File

@ -1,5 +1,5 @@
from django.http import HttpResponse
from django.urls import include, path, re_path
from django.urls import include, path
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.api.v2.router import WagtailAPIRouter
@ -34,7 +34,7 @@ urlpatterns = [
'sitemaps': {'pages': Sitemap, 'events': EventSitemap(request=None)},
'sitemap_url_name': 'sitemap',
}),
re_path(r'^sitemap-(?P<section>.+)\.xml$', sitemaps_views.sitemap, name='sitemap'),
path('sitemap-<str:section>.xml', sitemaps_views.sitemap, name='sitemap'),
path('testapp/', include(testapp_urls)),

View File

@ -1,4 +1,4 @@
from django.urls import path, re_path
from django.urls import path
from wagtail.users.views import users
@ -6,6 +6,6 @@ app_name = 'wagtailusers_users'
urlpatterns = [
path('', users.index, name='index'),
path('add/', users.create, name='add'),
re_path(r'^([^\/]+)/$', users.edit, name='edit'),
re_path(r'^([^\/]+)/delete/$', users.delete, name='delete'),
path('<str:user_id>/', users.edit, name='edit'),
path('<str:user_id>/delete/', users.delete, name='delete'),
]