forked from DGNum/gestioCOF
Better URL management
This commit is contained in:
parent
858a0c61e2
commit
5f8b8661bf
1 changed files with 25 additions and 34 deletions
59
cof/urls.py
59
cof/urls.py
|
@ -14,45 +14,30 @@ urlpatterns = [
|
|||
path("admin/", admin.site.urls),
|
||||
]
|
||||
|
||||
if "gestioncof" in settings.INSTALLED_APPS:
|
||||
# App-specific urls
|
||||
# TODO : mettre le préfixe de bds à "" sur gestioBDS ?
|
||||
app_dict = {
|
||||
"bds": "bds/",
|
||||
"gestioncof": "",
|
||||
"bda": "bda/",
|
||||
"petitscours": "petitcours/",
|
||||
"kfet": "k-fet",
|
||||
# events module is still experimental !
|
||||
"events": "event_v2/",
|
||||
"authens": "authens/",
|
||||
}
|
||||
for (app_name, url_prefix) in app_dict.items():
|
||||
if app_name in settings.INSTALLED_APPS:
|
||||
urlpatterns += [path(url_prefix, include("{}.urls".format(app_name)))]
|
||||
|
||||
|
||||
if "django_js_reverse" in settings.INSTALLED_APPS:
|
||||
from django_js_reverse.views import urls_js
|
||||
from wagtail.admin import urls as wagtailadmin_urls
|
||||
from wagtail.documents import urls as wagtaildocs_urls
|
||||
|
||||
|
||||
# Also includes BdA, K-Fêt, etc.
|
||||
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
|
||||
path("", gestioncof_views.HomeView.as_view(), name="home"),
|
||||
# Le BdA
|
||||
path("bda/", include("bda.urls")),
|
||||
# Les petits cours
|
||||
path("petitcours/", include("petitscours.urls")),
|
||||
path("k-fet/", include("kfet.urls")),
|
||||
path("cms/", include(wagtailadmin_urls)),
|
||||
path("documents/", include(wagtaildocs_urls)),
|
||||
# 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:
|
||||
# The new event application is still in development
|
||||
# → for now it is namespaced below events_v2
|
||||
# → rename this when the old events system is out
|
||||
urlpatterns += [path("event_v2/", include("events.urls"))]
|
||||
|
||||
if "authens" in settings.INSTALLED_APPS:
|
||||
urlpatterns.append(path("authens/", include("authens.urls")))
|
||||
|
||||
if "debug_toolbar" in settings.INSTALLED_APPS:
|
||||
import debug_toolbar
|
||||
|
||||
|
@ -63,10 +48,16 @@ if settings.DEBUG:
|
|||
# Il faut dire à Django de servir MEDIA_ROOT lui-même en développement.
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
# Wagtail for uncatched
|
||||
# Wagtail URLs (wagtail.core urls must be last, as catch-all)
|
||||
if "wagtail.core" in settings.INSTALLED_APPS:
|
||||
from wagtail.core import urls as wagtail_urls
|
||||
from wagtail.admin import urls as wagtailadmin_urls
|
||||
from wagtail.documents import urls as wagtaildocs_urls
|
||||
|
||||
urlpatterns += [
|
||||
path("cms/", include(wagtailadmin_urls)),
|
||||
path("documents/", include(wagtaildocs_urls)),
|
||||
]
|
||||
urlpatterns += i18n_patterns(
|
||||
path("", include(wagtail_urls)), prefix_default_language=False
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue