1
0
mirror of https://github.com/django/django.git synced 2024-12-30 13:05:45 +00:00
django/tests/urlpatterns/path_base64_urls.py
Eric Brandwein b0b4aac555 Fixed #29775 -- Fixed URL converters in a nested namespaced path.
When using include() without namespaces of some urlpatterns that
have an include() with namespace, the converters of the parent
include() weren't being used to convert the arguments of reverse().
2018-10-04 11:42:27 -04:00

24 lines
726 B
Python

from django.urls import include, path, register_converter
from . import converters, views
register_converter(converters.Base64Converter, 'base64')
subsubpatterns = [
path('<base64:last_value>/', views.empty_view, name='subsubpattern-base64'),
]
subpatterns = [
path('<base64:value>/', views.empty_view, name='subpattern-base64'),
path(
'<base64:value>/',
include((subsubpatterns, 'second-layer-namespaced-base64'), 'instance-ns-base64')
),
]
urlpatterns = [
path('base64/<base64:value>/', views.empty_view, name='base64'),
path('base64/<base64:base>/subpatterns/', include(subpatterns)),
path('base64/<base64:base>/namespaced/', include((subpatterns, 'namespaced-base64'))),
]