From 7a3707eca0db869c3ae9cdf9ed0a144fbc7dcb99 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Thu, 26 Oct 2017 16:10:06 +0100 Subject: [PATCH] Moved `app_name` URLconf setting into included urls modules --- wagtail/api/v2/router.py | 2 +- wagtail/contrib/settings/urls.py | 1 + wagtail/contrib/settings/wagtail_hooks.py | 2 +- wagtail/contrib/wagtailsearchpromotions/admin_urls.py | 1 + wagtail/contrib/wagtailsearchpromotions/wagtail_hooks.py | 2 +- wagtail/wagtailadmin/urls/__init__.py | 2 +- wagtail/wagtailadmin/urls/collections.py | 1 + wagtail/wagtailadmin/urls/pages.py | 1 + wagtail/wagtailadmin/viewsets/__init__.py | 2 +- wagtail/wagtaildocs/admin_urls.py | 1 + wagtail/wagtaildocs/wagtail_hooks.py | 2 +- wagtail/wagtailembeds/urls.py | 1 + wagtail/wagtailembeds/wagtail_hooks.py | 2 +- wagtail/wagtailforms/urls.py | 1 + wagtail/wagtailforms/wagtail_hooks.py | 2 +- wagtail/wagtailimages/admin_urls.py | 1 + wagtail/wagtailimages/wagtail_hooks.py | 2 +- wagtail/wagtailredirects/urls.py | 1 + wagtail/wagtailredirects/wagtail_hooks.py | 2 +- wagtail/wagtailsearch/urls/admin.py | 1 + wagtail/wagtailsearch/urls/frontend.py | 1 + wagtail/wagtailsnippets/urls.py | 1 + wagtail/wagtailsnippets/wagtail_hooks.py | 2 +- wagtail/wagtailusers/urls/users.py | 1 + wagtail/wagtailusers/wagtail_hooks.py | 2 +- 25 files changed, 25 insertions(+), 12 deletions(-) diff --git a/wagtail/api/v2/router.py b/wagtail/api/v2/router.py index f7e2904c92..ac93c2c4bf 100644 --- a/wagtail/api/v2/router.py +++ b/wagtail/api/v2/router.py @@ -72,7 +72,7 @@ class WagtailAPIRouter(object): for name, class_ in self._endpoints.items(): pattern = url( r'^{}/'.format(name), - include(class_.get_urlpatterns(), namespace=name) + include((class_.get_urlpatterns(), name), namespace=name) ) urlpatterns.append(pattern) diff --git a/wagtail/contrib/settings/urls.py b/wagtail/contrib/settings/urls.py index 1a71db21a8..90eca89d0e 100644 --- a/wagtail/contrib/settings/urls.py +++ b/wagtail/contrib/settings/urls.py @@ -4,6 +4,7 @@ from django.conf.urls import url from . import views +app_name = 'wagtailsettings' urlpatterns = [ url(r'^(\w+)/(\w+)/$', views.edit_current_site, name='edit'), url(r'^(\w+)/(\w+)/(\d+)/$', views.edit, name='edit'), diff --git a/wagtail/contrib/settings/wagtail_hooks.py b/wagtail/contrib/settings/wagtail_hooks.py index dae441bdc6..88c59eb421 100644 --- a/wagtail/contrib/settings/wagtail_hooks.py +++ b/wagtail/contrib/settings/wagtail_hooks.py @@ -10,5 +10,5 @@ from . import urls @hooks.register('register_admin_urls') def register_admin_urls(): return [ - url(r'^settings/', include(urls, app_name='wagtailsettings', namespace='wagtailsettings')), + url(r'^settings/', include(urls, namespace='wagtailsettings')), ] diff --git a/wagtail/contrib/wagtailsearchpromotions/admin_urls.py b/wagtail/contrib/wagtailsearchpromotions/admin_urls.py index 03bab11c9e..f7d50c78b0 100644 --- a/wagtail/contrib/wagtailsearchpromotions/admin_urls.py +++ b/wagtail/contrib/wagtailsearchpromotions/admin_urls.py @@ -4,6 +4,7 @@ from django.conf.urls import url from wagtail.contrib.wagtailsearchpromotions import views +app_name = 'wagtailsearchpromotions' urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^add/$', views.add, name='add'), diff --git a/wagtail/contrib/wagtailsearchpromotions/wagtail_hooks.py b/wagtail/contrib/wagtailsearchpromotions/wagtail_hooks.py index 3710734f54..9ed4a21195 100644 --- a/wagtail/contrib/wagtailsearchpromotions/wagtail_hooks.py +++ b/wagtail/contrib/wagtailsearchpromotions/wagtail_hooks.py @@ -13,7 +13,7 @@ from wagtail.wagtailcore import hooks @hooks.register('register_admin_urls') def register_admin_urls(): return [ - url(r'^searchpicks/', include(admin_urls, app_name='wagtailsearchpromotions', namespace='wagtailsearchpromotions')), + url(r'^searchpicks/', include(admin_urls, namespace='wagtailsearchpromotions')), ] diff --git a/wagtail/wagtailadmin/urls/__init__.py b/wagtail/wagtailadmin/urls/__init__.py index 709dd7f472..c94729d779 100644 --- a/wagtail/wagtailadmin/urls/__init__.py +++ b/wagtail/wagtailadmin/urls/__init__.py @@ -29,7 +29,7 @@ urlpatterns = [ url(r'^pages/$', pages.index, name='wagtailadmin_explore_root'), url(r'^pages/(\d+)/$', pages.index, name='wagtailadmin_explore'), - url(r'^pages/', include(wagtailadmin_pages_urls, app_name='wagtailadmin_pages', namespace='wagtailadmin_pages')), + url(r'^pages/', include(wagtailadmin_pages_urls, namespace='wagtailadmin_pages')), # TODO: Move into wagtailadmin_pages namespace url(r'^choose-page/$', chooser.browse, name='wagtailadmin_choose_page'), diff --git a/wagtail/wagtailadmin/urls/collections.py b/wagtail/wagtailadmin/urls/collections.py index f016eb487f..b885c25a31 100644 --- a/wagtail/wagtailadmin/urls/collections.py +++ b/wagtail/wagtailadmin/urls/collections.py @@ -4,6 +4,7 @@ from django.conf.urls import url from wagtail.wagtailadmin.views import collection_privacy, collections +app_name = 'wagtailadmin_collections' urlpatterns = [ url(r'^$', collections.Index.as_view(), name='index'), url(r'^add/$', collections.Create.as_view(), name='add'), diff --git a/wagtail/wagtailadmin/urls/pages.py b/wagtail/wagtailadmin/urls/pages.py index 55aaa7f9f2..910b5c7e09 100644 --- a/wagtail/wagtailadmin/urls/pages.py +++ b/wagtail/wagtailadmin/urls/pages.py @@ -4,6 +4,7 @@ from django.conf.urls import url from wagtail.wagtailadmin.views import page_privacy, pages +app_name = 'wagtailadmin_pages' urlpatterns = [ url(r'^add/(\w+)/(\w+)/(\d+)/$', pages.create, name='add'), url(r'^add/(\w+)/(\w+)/(\d+)/preview/$', pages.PreviewOnCreate.as_view(), name='preview_on_add'), diff --git a/wagtail/wagtailadmin/viewsets/__init__.py b/wagtail/wagtailadmin/viewsets/__init__.py index 890a3b94b2..ef2fce9019 100644 --- a/wagtail/wagtailadmin/viewsets/__init__.py +++ b/wagtail/wagtailadmin/viewsets/__init__.py @@ -25,7 +25,7 @@ class ViewSetRegistry(object): if vs_urlpatterns: urlpatterns.append(url( r'^{}/'.format(viewset.url_prefix), - include(vs_urlpatterns, namespace=viewset.name) + include((vs_urlpatterns, viewset.name), namespace=viewset.name) )) return urlpatterns diff --git a/wagtail/wagtaildocs/admin_urls.py b/wagtail/wagtaildocs/admin_urls.py index bfc7af0c9b..0468b9e8a4 100644 --- a/wagtail/wagtaildocs/admin_urls.py +++ b/wagtail/wagtaildocs/admin_urls.py @@ -4,6 +4,7 @@ from django.conf.urls import url from wagtail.wagtaildocs.views import chooser, documents, multiple +app_name = 'wagtaildocs' urlpatterns = [ url(r'^$', documents.index, name='index'), url(r'^add/$', documents.add, name='add'), diff --git a/wagtail/wagtaildocs/wagtail_hooks.py b/wagtail/wagtaildocs/wagtail_hooks.py index 4d2d19d40c..bf60688eb2 100644 --- a/wagtail/wagtaildocs/wagtail_hooks.py +++ b/wagtail/wagtaildocs/wagtail_hooks.py @@ -27,7 +27,7 @@ from wagtail.wagtaildocs.rich_text import DocumentLinkHandler @hooks.register('register_admin_urls') def register_admin_urls(): return [ - url(r'^documents/', include(admin_urls, app_name='wagtaildocs', namespace='wagtaildocs')), + url(r'^documents/', include(admin_urls, namespace='wagtaildocs')), ] diff --git a/wagtail/wagtailembeds/urls.py b/wagtail/wagtailembeds/urls.py index 85f7cebd8b..db08ce20f2 100644 --- a/wagtail/wagtailembeds/urls.py +++ b/wagtail/wagtailembeds/urls.py @@ -4,6 +4,7 @@ from django.conf.urls import url from wagtail.wagtailembeds.views import chooser +app_name = 'wagtailembeds' urlpatterns = [ url(r'^chooser/$', chooser.chooser, name='chooser'), url(r'^chooser/upload/$', chooser.chooser_upload, name='chooser_upload'), diff --git a/wagtail/wagtailembeds/wagtail_hooks.py b/wagtail/wagtailembeds/wagtail_hooks.py index e09b3919e7..6ce1b08ca4 100644 --- a/wagtail/wagtailembeds/wagtail_hooks.py +++ b/wagtail/wagtailembeds/wagtail_hooks.py @@ -13,7 +13,7 @@ from wagtail.wagtailembeds.rich_text import MediaEmbedHandler @hooks.register('register_admin_urls') def register_admin_urls(): return [ - url(r'^embeds/', include(urls, app_name='wagtailembeds', namespace='wagtailembeds')), + url(r'^embeds/', include(urls, namespace='wagtailembeds')), ] diff --git a/wagtail/wagtailforms/urls.py b/wagtail/wagtailforms/urls.py index 793e870b1b..9fd85ebf3d 100644 --- a/wagtail/wagtailforms/urls.py +++ b/wagtail/wagtailforms/urls.py @@ -4,6 +4,7 @@ from django.conf.urls import url from wagtail.wagtailforms import views +app_name = 'wagtailforms' urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^submissions/(\d+)/$', views.list_submissions, name='list_submissions'), diff --git a/wagtail/wagtailforms/wagtail_hooks.py b/wagtail/wagtailforms/wagtail_hooks.py index 4d1a6898ca..f79d7015b3 100644 --- a/wagtail/wagtailforms/wagtail_hooks.py +++ b/wagtail/wagtailforms/wagtail_hooks.py @@ -13,7 +13,7 @@ from wagtail.wagtailforms.models import get_forms_for_user @hooks.register('register_admin_urls') def register_admin_urls(): return [ - url(r'^forms/', include(urls, app_name='wagtailforms', namespace='wagtailforms')), + url(r'^forms/', include(urls, namespace='wagtailforms')), ] diff --git a/wagtail/wagtailimages/admin_urls.py b/wagtail/wagtailimages/admin_urls.py index 36f5d58217..179f1399ed 100644 --- a/wagtail/wagtailimages/admin_urls.py +++ b/wagtail/wagtailimages/admin_urls.py @@ -4,6 +4,7 @@ from django.conf.urls import url from wagtail.wagtailimages.views import chooser, images, multiple +app_name = 'wagtailimages' urlpatterns = [ url(r'^$', images.index, name='index'), url(r'^(\d+)/$', images.edit, name='edit'), diff --git a/wagtail/wagtailimages/wagtail_hooks.py b/wagtail/wagtailimages/wagtail_hooks.py index 9a4781e2bc..b0a8c419a8 100644 --- a/wagtail/wagtailimages/wagtail_hooks.py +++ b/wagtail/wagtailimages/wagtail_hooks.py @@ -22,7 +22,7 @@ from wagtail.wagtailimages.rich_text import ImageEmbedHandler @hooks.register('register_admin_urls') def register_admin_urls(): return [ - url(r'^images/', include(admin_urls, namespace='wagtailimages', app_name='wagtailimages')), + url(r'^images/', include(admin_urls, namespace='wagtailimages')), ] diff --git a/wagtail/wagtailredirects/urls.py b/wagtail/wagtailredirects/urls.py index faff5124d5..6ed5f83657 100644 --- a/wagtail/wagtailredirects/urls.py +++ b/wagtail/wagtailredirects/urls.py @@ -4,6 +4,7 @@ from django.conf.urls import url from wagtail.wagtailredirects import views +app_name = 'wagtailredirects' urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^add/$', views.add, name='add'), diff --git a/wagtail/wagtailredirects/wagtail_hooks.py b/wagtail/wagtailredirects/wagtail_hooks.py index 722a5c4f8a..b531c813a9 100644 --- a/wagtail/wagtailredirects/wagtail_hooks.py +++ b/wagtail/wagtailredirects/wagtail_hooks.py @@ -14,7 +14,7 @@ from wagtail.wagtailredirects.permissions import permission_policy @hooks.register('register_admin_urls') def register_admin_urls(): return [ - url(r'^redirects/', include(urls, app_name='wagtailredirects', namespace='wagtailredirects')), + url(r'^redirects/', include(urls, namespace='wagtailredirects')), ] diff --git a/wagtail/wagtailsearch/urls/admin.py b/wagtail/wagtailsearch/urls/admin.py index 94beeb94bc..a184941955 100644 --- a/wagtail/wagtailsearch/urls/admin.py +++ b/wagtail/wagtailsearch/urls/admin.py @@ -4,6 +4,7 @@ from django.conf.urls import url from wagtail.wagtailsearch.views import queries +app_name = 'wagtailsearch_admin' urlpatterns = [ url(r"^queries/chooser/$", queries.chooser, name="queries_chooser"), url(r"^queries/chooser/results/$", queries.chooserresults, name="queries_chooserresults"), diff --git a/wagtail/wagtailsearch/urls/frontend.py b/wagtail/wagtailsearch/urls/frontend.py index c9a4068110..7cd071caaf 100644 --- a/wagtail/wagtailsearch/urls/frontend.py +++ b/wagtail/wagtailsearch/urls/frontend.py @@ -4,6 +4,7 @@ from django.conf.urls import url from wagtail.wagtailsearch.views import search +app_name = 'wagtailsearch_frontend' urlpatterns = [ url(r'^$', search, name='wagtailsearch_search'), url(r'^suggest/$', search, {'use_json': True}, name='wagtailsearch_suggest'), diff --git a/wagtail/wagtailsnippets/urls.py b/wagtail/wagtailsnippets/urls.py index 5dadee2c15..7c1906a808 100644 --- a/wagtail/wagtailsnippets/urls.py +++ b/wagtail/wagtailsnippets/urls.py @@ -4,6 +4,7 @@ from django.conf.urls import url from wagtail.wagtailsnippets.views import chooser, snippets +app_name = 'wagtailsnippets' urlpatterns = [ url(r'^$', snippets.index, name='index'), diff --git a/wagtail/wagtailsnippets/wagtail_hooks.py b/wagtail/wagtailsnippets/wagtail_hooks.py index 1be463bc2a..ecaed007d7 100644 --- a/wagtail/wagtailsnippets/wagtail_hooks.py +++ b/wagtail/wagtailsnippets/wagtail_hooks.py @@ -18,7 +18,7 @@ from wagtail.wagtailsnippets.permissions import user_can_edit_snippets @hooks.register('register_admin_urls') def register_admin_urls(): return [ - url(r'^snippets/', include(urls, app_name='wagtailsnippets', namespace='wagtailsnippets')), + url(r'^snippets/', include(urls, namespace='wagtailsnippets')), ] diff --git a/wagtail/wagtailusers/urls/users.py b/wagtail/wagtailusers/urls/users.py index 11b22dd43f..8ec607b566 100644 --- a/wagtail/wagtailusers/urls/users.py +++ b/wagtail/wagtailusers/urls/users.py @@ -4,6 +4,7 @@ from django.conf.urls import url from wagtail.wagtailusers.views import users +app_name = 'wagtailusers_users' urlpatterns = [ url(r'^$', users.index, name='index'), url(r'^add/$', users.create, name='add'), diff --git a/wagtail/wagtailusers/wagtail_hooks.py b/wagtail/wagtailusers/wagtail_hooks.py index 9de15b3e8d..988fb542ff 100644 --- a/wagtail/wagtailusers/wagtail_hooks.py +++ b/wagtail/wagtailusers/wagtail_hooks.py @@ -19,7 +19,7 @@ from wagtail.wagtailusers.widgets import UserListingButton @hooks.register('register_admin_urls') def register_admin_urls(): return [ - url(r'^users/', include(users, app_name='wagtailusers_users', namespace='wagtailusers_users')), + url(r'^users/', include(users, namespace='wagtailusers_users')), ]