2016-11-06 15:39:14 +01:00
|
|
|
"""
|
|
|
|
Fichier principal de configuration des urls du projet GestioCOF
|
|
|
|
"""
|
|
|
|
|
2017-10-19 01:12:52 +02:00
|
|
|
from allauth_ens.views import capture_login, capture_logout
|
2016-07-09 19:49:38 +02:00
|
|
|
from django.conf import settings
|
2016-07-18 18:46:48 +02:00
|
|
|
from django.conf.urls import include, url
|
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
|
2017-10-19 01:12:52 +02:00
|
|
|
from django.views.generic import RedirectView
|
2017-05-30 20:44:30 +02:00
|
|
|
from wagtail.wagtailadmin import urls as wagtailadmin_urls
|
|
|
|
from wagtail.wagtailcore import urls as wagtail_urls
|
|
|
|
from wagtail.wagtaildocs import urls as wagtaildocs_urls
|
|
|
|
|
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,
|
|
|
|
petitcours_patterns,
|
|
|
|
surveys_patterns,
|
|
|
|
)
|
2016-07-18 18:46:48 +02:00
|
|
|
|
2016-07-09 21:19:37 +02:00
|
|
|
admin.autodiscover()
|
|
|
|
|
2017-10-19 01:12:52 +02:00
|
|
|
redirect_to_home = RedirectView.as_view(pattern_name="home")
|
|
|
|
|
2016-11-06 01:36:10 +01:00
|
|
|
urlpatterns = [
|
2016-06-08 22:28:38 +02:00
|
|
|
# Page d'accueil
|
2018-10-06 12:35:49 +02:00
|
|
|
url(r"^$", gestioncof_views.home, name="home"),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Le BdA
|
2018-10-06 12:35:49 +02:00
|
|
|
url(r"^bda/", include("bda.urls")),
|
2016-07-09 21:19:37 +02:00
|
|
|
# Les exports
|
2018-10-06 12:35:49 +02:00
|
|
|
url(r"^export/", include(export_patterns)),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Les petits cours
|
2018-10-06 12:35:49 +02:00
|
|
|
url(r"^petitcours/", include(petitcours_patterns)),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Les sondages
|
2018-10-06 12:35:49 +02:00
|
|
|
url(r"^survey/", include(surveys_patterns)),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Evenements
|
2018-10-06 12:35:49 +02:00
|
|
|
url(r"^event/", include(events_patterns)),
|
2016-07-15 01:06:33 +02:00
|
|
|
# Calendrier
|
2018-10-06 12:35:49 +02:00
|
|
|
url(r"^calendar/", include(calendar_patterns)),
|
2016-08-23 18:57:59 +02:00
|
|
|
# Clubs
|
2018-10-06 12:35:49 +02:00
|
|
|
url(r"^clubs/", include(clubs_patterns)),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Inscription d'un nouveau membre
|
2018-10-06 12:35:49 +02:00
|
|
|
url(r"^registration$", gestioncof_views.registration, name="registration"),
|
|
|
|
url(
|
|
|
|
r"^registration/clipper/(?P<login_clipper>[\w-]+)/" r"(?P<fullname>.*)$",
|
|
|
|
gestioncof_views.registration_form2,
|
|
|
|
name="clipper-registration",
|
|
|
|
),
|
|
|
|
url(
|
|
|
|
r"^registration/user/(?P<username>.+)$",
|
|
|
|
gestioncof_views.registration_form2,
|
|
|
|
name="user-registration",
|
|
|
|
),
|
|
|
|
url(
|
|
|
|
r"^registration/empty$",
|
|
|
|
gestioncof_views.registration_form2,
|
|
|
|
name="empty-registration",
|
|
|
|
),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Autocompletion
|
2018-10-06 12:35:49 +02:00
|
|
|
url(
|
|
|
|
r"^autocomplete/registration$",
|
|
|
|
autocomplete,
|
|
|
|
name="cof.registration.autocomplete",
|
|
|
|
),
|
|
|
|
url(
|
|
|
|
r"^user/autocomplete$",
|
|
|
|
gestioncof_views.user_autocomplete,
|
|
|
|
name="cof-user-autocomplete",
|
|
|
|
),
|
2016-06-08 22:28:38 +02:00
|
|
|
# Liens utiles du COF et du BdA
|
2018-10-06 12:35:49 +02:00
|
|
|
url(r"^utile_cof$", gestioncof_views.utile_cof, name="utile_cof"),
|
|
|
|
url(r"^utile_bda$", gestioncof_views.utile_bda, name="utile_bda"),
|
|
|
|
url(r"^utile_bda/bda_diff$", gestioncof_views.liste_bdadiff, name="ml_diffbda"),
|
|
|
|
url(r"^utile_cof/diff_cof$", gestioncof_views.liste_diffcof, name="ml_diffcof"),
|
|
|
|
url(
|
|
|
|
r"^utile_bda/bda_revente$",
|
|
|
|
gestioncof_views.liste_bdarevente,
|
|
|
|
name="ml_bda_revente",
|
|
|
|
),
|
|
|
|
url(r"^k-fet/", include("kfet.urls")),
|
2017-05-26 00:58:59 +02:00
|
|
|
# djconfig
|
2018-10-06 12:35:49 +02:00
|
|
|
url(r"^config", gestioncof_views.ConfigUpdate.as_view(), name="config.edit"),
|
2016-09-12 22:08:39 +02:00
|
|
|
]
|
|
|
|
|
2017-10-19 01:12:52 +02:00
|
|
|
# Admin site
|
|
|
|
|
|
|
|
admin_urls = [
|
|
|
|
# Replace the login and logout views with allauth ones.
|
|
|
|
url(r"^login/", capture_login),
|
|
|
|
url(r"^logout/", capture_logout),
|
|
|
|
url(r"^doc/", include("django.contrib.admindocs.urls")),
|
|
|
|
url(
|
|
|
|
r"^(?P<app_label>[\d\w]+)/(?P<model_name>[\d\w]+)/csv/",
|
|
|
|
csv_views.admin_list_export,
|
|
|
|
{"fields": ["username"]},
|
|
|
|
),
|
|
|
|
url(r"^", include(admin.site.urls)),
|
|
|
|
]
|
|
|
|
|
|
|
|
urlpatterns += [url(r"^admin/", include(admin_urls))]
|
|
|
|
|
|
|
|
# Profile urls.
|
|
|
|
# https://django-allauth.readthedocs.io/en/latest/
|
|
|
|
|
|
|
|
profile_urls = [
|
|
|
|
url(r"^edition/$", gestioncof_views.profile, name="profile.edit"),
|
|
|
|
# allauth urls
|
|
|
|
# Multiple emails management is unused.
|
|
|
|
url(r"^email/", redirect_to_home),
|
|
|
|
url(r"^", include("allauth.urls")),
|
|
|
|
]
|
|
|
|
|
|
|
|
urlpatterns += [url(r"^profil/", include(profile_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
|
|
|
|
|
|
|
urlpatterns += [url(r"^__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
|
|
|
|
2017-10-19 01:12:52 +02:00
|
|
|
cms_urls = [
|
|
|
|
# Replace Wagtail login and logout views with allauth ones.
|
|
|
|
url(r"^cms/login/", capture_login),
|
|
|
|
url(r"^cms/logout/", capture_logout),
|
|
|
|
# Wagtail admin.
|
|
|
|
url(r"^cms/", include(wagtailadmin_urls)),
|
|
|
|
url(r"^documents/", include(wagtaildocs_urls)),
|
|
|
|
# Wagtail serves all uncatched requests.
|
|
|
|
url(r"", include(wagtail_urls)),
|
|
|
|
]
|
|
|
|
|
|
|
|
urlpatterns += cms_urls
|