2016-11-06 15:39:14 +01:00
|
|
|
"""
|
|
|
|
Fichier principal de configuration des urls du projet GestioCOF
|
|
|
|
"""
|
|
|
|
|
2016-07-09 19:49:38 +02:00
|
|
|
from django.conf import settings
|
2018-02-03 22:34:37 +01:00
|
|
|
from django.conf.urls.i18n import i18n_patterns
|
2016-07-09 19:49:38 +02:00
|
|
|
from django.conf.urls.static import static
|
2016-05-21 23:57:36 +02:00
|
|
|
from django.contrib import admin
|
2019-04-12 17:05:18 +02:00
|
|
|
from django.contrib.auth import views as django_auth_views
|
|
|
|
from django.urls import include, path
|
2018-10-06 12:35:49 +02:00
|
|
|
from django.views.generic.base import TemplateView
|
2016-07-18 18:46:48 +02:00
|
|
|
from django_cas_ng import views as django_cas_views
|
2019-02-04 22:50:27 +01:00
|
|
|
from wagtail.admin import urls as wagtailadmin_urls
|
|
|
|
from wagtail.core import urls as wagtail_urls
|
|
|
|
from wagtail.documents import urls as wagtaildocs_urls
|
2017-05-30 20:44:30 +02:00
|
|
|
|
2018-10-06 12:35:49 +02:00
|
|
|
from gestioncof import csv_views, views as gestioncof_views
|
2016-07-18 18:46:48 +02:00
|
|
|
from gestioncof.autocomplete import autocomplete
|
2018-10-06 12:35:49 +02:00
|
|
|
from gestioncof.urls import (
|
|
|
|
calendar_patterns,
|
|
|
|
clubs_patterns,
|
|
|
|
events_patterns,
|
|
|
|
export_patterns,
|
|
|
|
surveys_patterns,
|
|
|
|
)
|
2016-07-18 18:46:48 +02:00
|
|
|
|
2016-07-09 21:19:37 +02:00
|
|
|
admin.autodiscover()
|
|
|
|
|
2016-11-06 01:36:10 +01:00
|
|
|
urlpatterns = [
|
2016-06-08 22:28:38 +02:00
|
|
|
# Page d'accueil
|
2019-10-06 00:28:32 +02:00
|
|
|
path("", gestioncof_views.HomeView.as_view(), name="home"),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Le BdA
|
2019-04-12 17:05:18 +02:00
|
|
|
path("bda/", include("bda.urls")),
|
2016-07-09 21:19:37 +02:00
|
|
|
# Les exports
|
2019-04-12 17:05:18 +02:00
|
|
|
path("export/", include(export_patterns)),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Les petits cours
|
2019-04-12 17:05:18 +02:00
|
|
|
path("petitcours/", include("petitscours.urls")),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Les sondages
|
2019-04-12 17:05:18 +02:00
|
|
|
path("survey/", include(surveys_patterns)),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Evenements
|
2019-04-12 17:05:18 +02:00
|
|
|
path("event/", include(events_patterns)),
|
2016-07-15 01:06:33 +02:00
|
|
|
# Calendrier
|
2019-04-12 17:05:18 +02:00
|
|
|
path("calendar/", include(calendar_patterns)),
|
2016-08-23 18:57:59 +02:00
|
|
|
# Clubs
|
2019-04-12 17:05:18 +02:00
|
|
|
path("clubs/", include(clubs_patterns)),
|
2016-07-09 21:19:37 +02:00
|
|
|
# Authentification
|
2019-04-12 17:05:18 +02:00
|
|
|
path(
|
|
|
|
"cof/denied",
|
2018-10-06 12:35:49 +02:00
|
|
|
TemplateView.as_view(template_name="cof-denied.html"),
|
|
|
|
name="cof-denied",
|
|
|
|
),
|
2019-04-12 17:05:18 +02:00
|
|
|
path("cas/login", django_cas_views.LoginView.as_view(), name="cas_login_view"),
|
|
|
|
path("cas/logout", django_cas_views.LogoutView.as_view()),
|
|
|
|
path(
|
|
|
|
"outsider/login", gestioncof_views.LoginExtView.as_view(), name="ext_login_view"
|
2019-03-25 23:05:47 +01:00
|
|
|
),
|
2019-04-12 17:05:18 +02:00
|
|
|
path(
|
|
|
|
"outsider/logout", django_auth_views.LogoutView.as_view(), {"next_page": "home"}
|
|
|
|
),
|
|
|
|
path("login", gestioncof_views.login, name="cof-login"),
|
|
|
|
path("logout", gestioncof_views.logout, name="cof-logout"),
|
2016-07-09 21:19:37 +02:00
|
|
|
# Infos persos
|
2019-04-12 17:05:18 +02:00
|
|
|
path("profile", gestioncof_views.profile, name="profile"),
|
|
|
|
path(
|
|
|
|
"outsider/password-change",
|
|
|
|
django_auth_views.PasswordChangeView.as_view(),
|
2018-10-06 12:35:49 +02:00
|
|
|
name="password_change",
|
|
|
|
),
|
2019-04-12 17:05:18 +02:00
|
|
|
path(
|
|
|
|
"outsider/password-change-done",
|
|
|
|
django_auth_views.PasswordChangeDoneView.as_view(),
|
2018-10-06 12:35:49 +02:00
|
|
|
name="password_change_done",
|
|
|
|
),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Inscription d'un nouveau membre
|
2019-04-12 17:05:18 +02:00
|
|
|
path("registration", gestioncof_views.registration, name="registration"),
|
|
|
|
path(
|
|
|
|
"registration/clipper/<slug:login_clipper>/<fullname>",
|
2018-10-06 12:35:49 +02:00
|
|
|
gestioncof_views.registration_form2,
|
|
|
|
name="clipper-registration",
|
|
|
|
),
|
2019-04-12 17:05:18 +02:00
|
|
|
path(
|
|
|
|
"registration/user/<username>",
|
2018-10-06 12:35:49 +02:00
|
|
|
gestioncof_views.registration_form2,
|
|
|
|
name="user-registration",
|
|
|
|
),
|
2019-04-12 17:05:18 +02:00
|
|
|
path(
|
|
|
|
"registration/empty",
|
2018-10-06 12:35:49 +02:00
|
|
|
gestioncof_views.registration_form2,
|
|
|
|
name="empty-registration",
|
|
|
|
),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Autocompletion
|
2019-04-12 17:05:18 +02:00
|
|
|
path(
|
|
|
|
"autocomplete/registration", autocomplete, name="cof.registration.autocomplete"
|
2018-10-06 12:35:49 +02:00
|
|
|
),
|
2019-04-12 17:05:18 +02:00
|
|
|
path(
|
|
|
|
"user/autocomplete",
|
2018-10-06 12:35:49 +02:00
|
|
|
gestioncof_views.user_autocomplete,
|
|
|
|
name="cof-user-autocomplete",
|
|
|
|
),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Interface admin
|
2019-04-12 17:05:18 +02:00
|
|
|
path("admin/logout/", gestioncof_views.logout),
|
|
|
|
path("admin/doc/", include("django.contrib.admindocs.urls")),
|
|
|
|
path(
|
|
|
|
"admin/<slug:app_label>/<slug:model_name>/csv/",
|
2016-07-18 18:46:48 +02:00
|
|
|
csv_views.admin_list_export,
|
2018-10-06 12:35:49 +02:00
|
|
|
{"fields": ["username"]},
|
|
|
|
),
|
2019-04-12 17:05:18 +02:00
|
|
|
path("admin/", admin.site.urls),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Liens utiles du COF et du BdA
|
2019-04-12 17:05:18 +02:00
|
|
|
path("utile_cof", gestioncof_views.utile_cof, name="utile_cof"),
|
|
|
|
path("utile_bda", gestioncof_views.utile_bda, name="utile_bda"),
|
|
|
|
path("utile_bda/bda_diff", gestioncof_views.liste_bdadiff, name="ml_diffbda"),
|
|
|
|
path("utile_cof/diff_cof", gestioncof_views.liste_diffcof, name="ml_diffcof"),
|
|
|
|
path(
|
|
|
|
"utile_bda/bda_revente",
|
2018-10-06 12:35:49 +02:00
|
|
|
gestioncof_views.liste_bdarevente,
|
|
|
|
name="ml_bda_revente",
|
|
|
|
),
|
2019-04-12 17:05:18 +02:00
|
|
|
path("k-fet/", include("kfet.urls")),
|
|
|
|
path("cms/", include(wagtailadmin_urls)),
|
|
|
|
path("documents/", include(wagtaildocs_urls)),
|
2017-05-26 00:58:59 +02:00
|
|
|
# djconfig
|
2019-04-12 17:05:18 +02:00
|
|
|
path("config", gestioncof_views.ConfigUpdate.as_view(), name="config.edit"),
|
2016-09-12 22:08:39 +02:00
|
|
|
]
|
|
|
|
|
2019-10-05 15:58:11 +02:00
|
|
|
if "events" in settings.INSTALLED_APPS:
|
|
|
|
# The new event application is still in development
|
|
|
|
# → for now it is namespaced below events_v2
|
|
|
|
# → when the old events system is out, move this above in the others apps
|
|
|
|
urlpatterns += [path("event_v2/", include("events.urls"))]
|
|
|
|
|
2018-10-06 12:35:49 +02:00
|
|
|
if "debug_toolbar" in settings.INSTALLED_APPS:
|
2016-11-06 15:39:14 +01:00
|
|
|
import debug_toolbar
|
2018-10-06 12:35:49 +02:00
|
|
|
|
2019-04-12 17:05:18 +02:00
|
|
|
urlpatterns += [path("__debug__/", include(debug_toolbar.urls))]
|
2016-11-06 15:39:14 +01:00
|
|
|
|
2017-05-30 20:44:30 +02:00
|
|
|
if settings.DEBUG:
|
2016-11-06 01:36:10 +01:00
|
|
|
# Si on est en production, MEDIA_ROOT est servi par Apache.
|
|
|
|
# Il faut dire à Django de servir MEDIA_ROOT lui-même en développement.
|
2018-10-06 12:35:49 +02:00
|
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
2017-05-30 20:44:30 +02:00
|
|
|
|
|
|
|
# Wagtail for uncatched
|
2018-02-03 22:34:37 +01:00
|
|
|
urlpatterns += i18n_patterns(
|
2019-04-12 17:05:18 +02:00
|
|
|
path("", include(wagtail_urls)), prefix_default_language=False
|
2018-02-03 22:34:37 +01:00
|
|
|
)
|