2018-12-08 06:52:28 +08:00
|
|
|
from django.urls import include, path, re_path
|
2011-10-14 05:34:56 +08:00
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
from . import views
|
2015-12-23 05:10:52 +08:00
|
|
|
from .utils import URLObject
|
2009-07-17 00:16:13 +08:00
|
|
|
|
|
|
|
testobj1 = URLObject("testapp", "test-ns1")
|
|
|
|
testobj2 = URLObject("testapp", "test-ns2")
|
|
|
|
default_testobj = URLObject("testapp", "testapp")
|
|
|
|
|
|
|
|
otherobj1 = URLObject("nodefault", "other-ns1")
|
|
|
|
otherobj2 = URLObject("nodefault", "other-ns2")
|
|
|
|
|
2015-05-28 23:25:52 +08:00
|
|
|
newappobj1 = URLObject("newapp")
|
|
|
|
|
2017-01-10 22:57:49 +08:00
|
|
|
app_name = "namespace_urls"
|
2014-04-02 08:46:34 +08:00
|
|
|
urlpatterns = [
|
2018-12-08 06:52:28 +08:00
|
|
|
path("normal/", views.empty_view, name="normal-view"),
|
|
|
|
re_path(
|
2017-01-10 22:57:49 +08:00
|
|
|
r"^normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$",
|
|
|
|
views.empty_view,
|
|
|
|
name="normal-view",
|
|
|
|
),
|
2018-12-08 06:52:28 +08:00
|
|
|
path("resolver_match/", views.pass_resolver_match_view, name="test-resolver-match"),
|
|
|
|
re_path(r"^\+\\\$\*/$", views.empty_view, name="special-view"),
|
|
|
|
re_path(
|
2022-03-28 23:56:20 +08:00
|
|
|
r"^mixed_args/([0-9]+)/(?P<arg2>[0-9]+)/$",
|
|
|
|
views.empty_view,
|
|
|
|
{"extra": True},
|
|
|
|
name="mixed-args",
|
2022-02-04 03:24:19 +08:00
|
|
|
),
|
2018-12-08 06:52:28 +08:00
|
|
|
re_path(r"^no_kwargs/([0-9]+)/([0-9]+)/$", views.empty_view, name="no-kwargs"),
|
2022-02-04 03:24:19 +08:00
|
|
|
re_path(
|
2018-12-08 06:52:28 +08:00
|
|
|
r"^view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$",
|
|
|
|
views.view_class_instance,
|
|
|
|
name="view-class",
|
2022-02-04 03:24:19 +08:00
|
|
|
),
|
2018-12-08 06:52:28 +08:00
|
|
|
re_path(r"^unnamed/normal/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$", views.empty_view),
|
2022-02-04 03:24:19 +08:00
|
|
|
re_path(
|
2018-12-08 06:52:28 +08:00
|
|
|
r"^unnamed/view_class/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$",
|
|
|
|
views.view_class_instance,
|
2022-02-04 03:24:19 +08:00
|
|
|
),
|
2018-12-08 06:52:28 +08:00
|
|
|
path("test1/", include(*testobj1.urls)),
|
|
|
|
path("test2/", include(*testobj2.urls)),
|
|
|
|
path("default/", include(*default_testobj.urls)),
|
|
|
|
path("other1/", include(*otherobj1.urls)),
|
|
|
|
re_path(r"^other[246]/", include(*otherobj2.urls)),
|
|
|
|
path("newapp1/", include(newappobj1.app_urls, "new-ns1")),
|
|
|
|
path("new-default/", include(newappobj1.app_urls)),
|
2022-02-04 03:24:19 +08:00
|
|
|
re_path(
|
2018-12-08 06:52:28 +08:00
|
|
|
r"^app-included[135]/",
|
|
|
|
include("urlpatterns_reverse.included_app_urls", namespace="app-ns1"),
|
2022-02-04 03:24:19 +08:00
|
|
|
),
|
|
|
|
path(
|
2018-12-08 06:52:28 +08:00
|
|
|
"app-included2/",
|
|
|
|
include("urlpatterns_reverse.included_app_urls", namespace="app-ns2"),
|
2022-02-04 03:24:19 +08:00
|
|
|
),
|
|
|
|
re_path(
|
2018-12-08 06:52:28 +08:00
|
|
|
r"^ns-included[135]/",
|
|
|
|
include("urlpatterns_reverse.included_namespace_urls", namespace="inc-ns1"),
|
2022-02-04 03:24:19 +08:00
|
|
|
),
|
|
|
|
path(
|
2018-12-08 06:52:28 +08:00
|
|
|
"ns-included2/",
|
|
|
|
include("urlpatterns_reverse.included_namespace_urls", namespace="inc-ns2"),
|
2022-02-04 03:24:19 +08:00
|
|
|
),
|
|
|
|
path(
|
2018-12-08 06:52:28 +08:00
|
|
|
"app-included/",
|
|
|
|
include("urlpatterns_reverse.included_namespace_urls", "inc-app"),
|
2022-02-04 03:24:19 +08:00
|
|
|
),
|
2018-12-08 06:52:28 +08:00
|
|
|
path("included/", include("urlpatterns_reverse.included_namespace_urls")),
|
2022-02-04 03:24:19 +08:00
|
|
|
re_path(
|
2018-12-08 06:52:28 +08:00
|
|
|
r"^inc(?P<outer>[0-9]+)/",
|
2022-02-04 03:24:19 +08:00
|
|
|
include(
|
2018-12-08 06:52:28 +08:00
|
|
|
("urlpatterns_reverse.included_urls", "included_urls"), namespace="inc-ns5"
|
2022-02-04 03:24:19 +08:00
|
|
|
),
|
|
|
|
),
|
|
|
|
re_path(
|
2018-12-08 06:52:28 +08:00
|
|
|
r"^included/([0-9]+)/", include("urlpatterns_reverse.included_namespace_urls")
|
2022-02-04 03:24:19 +08:00
|
|
|
),
|
|
|
|
re_path(
|
2015-09-12 07:33:12 +08:00
|
|
|
r"^ns-outer/(?P<outer>[0-9]+)/",
|
|
|
|
include("urlpatterns_reverse.included_namespace_urls", namespace="inc-outer"),
|
2022-02-04 03:24:19 +08:00
|
|
|
),
|
|
|
|
re_path(
|
2018-12-08 06:52:28 +08:00
|
|
|
r"^\+\\\$\*/",
|
|
|
|
include("urlpatterns_reverse.namespace_urls", namespace="special"),
|
2015-09-12 07:33:12 +08:00
|
|
|
),
|
2014-04-02 08:46:34 +08:00
|
|
|
]
|