File: urls.py

package info (click to toggle)
django-dynamic-preferences 1.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 476 kB
  • sloc: python: 3,040; makefile: 3
file content (33 lines) | stat: -rw-r--r-- 966 bytes parent folder | download
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
33
try:
    from django.urls import include, re_path
except ImportError:
    from django.conf.urls import include, url as re_path

from django.contrib.admin.views.decorators import staff_member_required
from . import views
from .registries import global_preferences_registry
from .forms import GlobalPreferenceForm

app_name = "dynamic_preferences"

urlpatterns = [
    re_path(
        r"^global/$",
        staff_member_required(
            views.PreferenceFormView.as_view(
                registry=global_preferences_registry, form_class=GlobalPreferenceForm
            )
        ),
        name="global",
    ),
    re_path(
        r"^global/(?P<section>[\w\ ]+)$",
        staff_member_required(
            views.PreferenceFormView.as_view(
                registry=global_preferences_registry, form_class=GlobalPreferenceForm
            )
        ),
        name="global.section",
    ),
    re_path(r"^user/", include("dynamic_preferences.users.urls")),
]