One url file to rule them all,

one url file to find them
One url file to bring them all,
and in the darkness bind them.
This commit is contained in:
Martin Pépin 2020-05-09 16:21:40 +02:00
parent d8e3cd6566
commit 0d8c97dbf7
No known key found for this signature in database
GPG key ID: E7520278B1774448
2 changed files with 130 additions and 113 deletions

2
bds/urls.py Normal file
View file

@ -0,0 +1,2 @@
app_label = "bds"
urlpatterns = []

View file

@ -8,27 +8,39 @@ from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.contrib.auth import views as django_auth_views from django.contrib.auth import views as django_auth_views
from django.urls import include, path from django.urls import include, path
from django.views.decorators.cache import cache_page
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from django_cas_ng import views as django_cas_views from django_cas_ng import views as django_cas_views
from django_js_reverse.views import urls_js
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls
from gestioncof import csv_views, views as gestioncof_views admin.autodiscover()
from gestioncof.autocomplete import autocomplete
from gestioncof.urls import (
urlpatterns = [
path("admin/doc/", include("django.contrib.admindocs.urls")),
path("admin/", admin.site.urls),
]
if "gestioncof" in settings.INSTALLED_APPS:
from gestioncof import csv_views, views as gestioncof_views
from gestioncof.autocomplete import autocomplete
from gestioncof.urls import (
calendar_patterns, calendar_patterns,
clubs_patterns, clubs_patterns,
events_patterns, events_patterns,
export_patterns, export_patterns,
surveys_patterns, surveys_patterns,
) )
from django_js_reverse.views import urls_js
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.documents import urls as wagtaildocs_urls
admin.autodiscover() # Also includes BdA, K-Fêt, etc.
urlpatterns += [
urlpatterns = [ path("admin/logout/", gestioncof_views.logout),
path(
"admin/<slug:app_label>/<slug:model_name>/csv/",
csv_views.admin_list_export,
{"fields": ["username"]},
),
# Page d'accueil # Page d'accueil
path("", gestioncof_views.HomeView.as_view(), name="home"), path("", gestioncof_views.HomeView.as_view(), name="home"),
# Le BdA # Le BdA
@ -54,10 +66,14 @@ urlpatterns = [
path("cas/login", django_cas_views.LoginView.as_view(), name="cas_login_view"), path("cas/login", django_cas_views.LoginView.as_view(), name="cas_login_view"),
path("cas/logout", django_cas_views.LogoutView.as_view()), path("cas/logout", django_cas_views.LogoutView.as_view()),
path( path(
"outsider/login", gestioncof_views.LoginExtView.as_view(), name="ext_login_view" "outsider/login",
gestioncof_views.LoginExtView.as_view(),
name="ext_login_view",
), ),
path( path(
"outsider/logout", django_auth_views.LogoutView.as_view(), {"next_page": "home"} "outsider/logout",
django_auth_views.LogoutView.as_view(),
{"next_page": "home"},
), ),
path("login", gestioncof_views.login, name="cof-login"), path("login", gestioncof_views.login, name="cof-login"),
path("logout", gestioncof_views.logout, name="cof-logout"), path("logout", gestioncof_views.logout, name="cof-logout"),
@ -92,22 +108,15 @@ urlpatterns = [
), ),
# Autocompletion # Autocompletion
path( path(
"autocomplete/registration", autocomplete, name="cof.registration.autocomplete" "autocomplete/registration",
autocomplete,
name="cof.registration.autocomplete",
), ),
path( path(
"user/autocomplete", "user/autocomplete",
gestioncof_views.user_autocomplete, gestioncof_views.user_autocomplete,
name="cof-user-autocomplete", name="cof-user-autocomplete",
), ),
# Interface admin
path("admin/logout/", gestioncof_views.logout),
path("admin/doc/", include("django.contrib.admindocs.urls")),
path(
"admin/<slug:app_label>/<slug:model_name>/csv/",
csv_views.admin_list_export,
{"fields": ["username"]},
),
path("admin/", admin.site.urls),
# Liens utiles du COF et du BdA # Liens utiles du COF et du BdA
path("utile_cof", gestioncof_views.utile_cof, name="utile_cof"), path("utile_cof", gestioncof_views.utile_cof, name="utile_cof"),
path("utile_bda", gestioncof_views.utile_bda, name="utile_bda"), path("utile_bda", gestioncof_views.utile_bda, name="utile_bda"),
@ -125,12 +134,15 @@ urlpatterns = [
path("config", gestioncof_views.ConfigUpdate.as_view(), name="config.edit"), path("config", gestioncof_views.ConfigUpdate.as_view(), name="config.edit"),
# js-reverse # js-reverse
path("jsreverse/", urls_js, name="js_reverse"), path("jsreverse/", urls_js, name="js_reverse"),
] ]
if "bds" in settings.INSTALLED_APPS:
urlpatterns.append(path("bds/", include("bds.urls")))
if "events" in settings.INSTALLED_APPS: if "events" in settings.INSTALLED_APPS:
# The new event application is still in development # The new event application is still in development
# → for now it is namespaced below events_v2 # → for now it is namespaced below events_v2
# → when the old events system is out, move this above in the others apps # → rename this when the old events system is out
urlpatterns += [path("event_v2/", include("events.urls"))] urlpatterns += [path("event_v2/", include("events.urls"))]
if "debug_toolbar" in settings.INSTALLED_APPS: if "debug_toolbar" in settings.INSTALLED_APPS:
@ -144,6 +156,9 @@ if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# Wagtail for uncatched # Wagtail for uncatched
urlpatterns += i18n_patterns( if "wagtail.core" in settings.INSTALLED_APPS:
from wagtail.core import urls as wagtail_urls
urlpatterns += i18n_patterns(
path("", include(wagtail_urls)), prefix_default_language=False path("", include(wagtail_urls)), prefix_default_language=False
) )