File: default.py

package info (click to toggle)
python-django 3%3A4.2.28-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 58,896 kB
  • sloc: python: 334,975; javascript: 18,754; xml: 215; makefile: 178; sh: 27
file content (32 lines) | stat: -rw-r--r-- 1,062 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from django.conf.urls.i18n import i18n_patterns
from django.urls import include, path, re_path
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView

view = TemplateView.as_view(template_name="dummy.html")

urlpatterns = [
    path("not-prefixed/", view, name="not-prefixed"),
    path("not-prefixed-include/", include("i18n.patterns.urls.included")),
    re_path(_(r"^translated/$"), view, name="no-prefix-translated"),
    re_path(
        _(r"^translated/(?P<slug>[\w-]+)/$"),
        view,
        {"slug": "default-slug"},
        name="no-prefix-translated-slug",
    ),
]

urlpatterns += i18n_patterns(
    path("prefixed/", view, name="prefixed"),
    path("prefixed.xml", view, name="prefixed_xml"),
    re_path(
        _(r"^with-arguments/(?P<argument>[\w-]+)/(?:(?P<optional>[\w-]+).html)?$"),
        view,
        name="with-arguments",
    ),
    re_path(_(r"^users/$"), view, name="users"),
    re_path(
        _(r"^account/"), include("i18n.patterns.urls.namespace", namespace="account")
    ),
)