2011-06-15 17:29:10 +00:00
|
|
|
from django.conf.urls.i18n import i18n_patterns
|
2018-12-07 22:52:28 +00:00
|
|
|
from django.urls import include, path, re_path
|
2017-01-26 19:58:33 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2011-06-15 17:29:10 +00:00
|
|
|
from django.views.generic import TemplateView
|
|
|
|
|
2022-02-03 19:24:19 +00:00
|
|
|
view = TemplateView.as_view(template_name="dummy.html")
|
2011-06-15 17:29:10 +00:00
|
|
|
|
2014-04-02 00:46:34 +00:00
|
|
|
urlpatterns = [
|
2022-02-03 19:24:19 +00:00
|
|
|
path("not-prefixed/", view, name="not-prefixed"),
|
|
|
|
path("not-prefixed-include/", include("i18n.patterns.urls.included")),
|
2024-02-24 19:58:12 +00:00
|
|
|
path(_("translated/"), view, name="no-prefix-translated"),
|
|
|
|
re_path(_(r"^translated-regex/$"), view, name="no-prefix-translated-regex"),
|
2022-02-03 19:24:19 +00:00
|
|
|
re_path(
|
2022-03-28 15:56:20 +00:00
|
|
|
_(r"^translated/(?P<slug>[\w-]+)/$"),
|
|
|
|
view,
|
|
|
|
{"slug": "default-slug"},
|
|
|
|
name="no-prefix-translated-slug",
|
2022-02-03 19:24:19 +00:00
|
|
|
),
|
2014-04-02 00:46:34 +00:00
|
|
|
]
|
2011-06-15 17:29:10 +00:00
|
|
|
|
2014-04-02 00:46:34 +00:00
|
|
|
urlpatterns += i18n_patterns(
|
2022-02-03 19:24:19 +00:00
|
|
|
path("prefixed/", view, name="prefixed"),
|
|
|
|
path("prefixed.xml", view, name="prefixed_xml"),
|
2019-06-21 15:37:41 +00:00
|
|
|
re_path(
|
2022-02-03 19:24:19 +00:00
|
|
|
_(r"^with-arguments/(?P<argument>[\w-]+)/(?:(?P<optional>[\w-]+).html)?$"),
|
2019-06-21 15:37:41 +00:00
|
|
|
view,
|
2022-02-03 19:24:19 +00:00
|
|
|
name="with-arguments",
|
|
|
|
),
|
2024-02-24 19:58:12 +00:00
|
|
|
path(
|
|
|
|
_("path-with-arguments/<str:argument>/"),
|
|
|
|
view,
|
|
|
|
name="path-with-arguments",
|
|
|
|
),
|
2022-02-03 19:24:19 +00:00
|
|
|
re_path(_(r"^users/$"), view, name="users"),
|
|
|
|
re_path(
|
|
|
|
_(r"^account/"), include("i18n.patterns.urls.namespace", namespace="account")
|
2019-06-21 15:37:41 +00:00
|
|
|
),
|
2011-06-15 17:29:10 +00:00
|
|
|
)
|