kpsul/cof/urls.py
2016-07-09 23:53:06 +01:00

81 lines
3.3 KiB
Python

# -*-coding:utf-8 -*
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
import autocomplete_light
from django.contrib import admin
from django.views.generic.base import TemplateView
from gestioncof.urls import export_patterns, petitcours_patterns, \
surveys_patterns, events_patterns
autocomplete_light.autodiscover()
admin.autodiscover()
urlpatterns = patterns(
'',
# Page d'accueil
url(r'^$', 'gestioncof.views.home', name='home'),
# Le BdA
url(r'^bda/', include('bda.urls')),
# Les exports
url(r'^export/', include(export_patterns)),
# Les petits cours
url(r'^petitcours/', include(petitcours_patterns)),
# Les sondages
url(r'^survey/', include(surveys_patterns)),
# Evenements
url(r'^event/', include(events_patterns)),
# Authentification
url(r'^cof/denied$', TemplateView.as_view(template_name='cof-denied.html'),
name="cof-denied"),
url(r'^cas/login$', 'django_cas_ng.views.login', name="cas_login_view"),
url(r'^cas/logout$', 'django_cas_ng.views.logout'),
url(r'^outsider/login$', 'gestioncof.views.login_ext'),
url(r'^outsider/logout$', 'django.contrib.auth.views.logout',
{'next_page': 'home'}),
url(r'^login$', 'gestioncof.views.login'),
url(r'^logout$', 'gestioncof.views.logout'),
# Infos persos
url(r'^profile$', 'gestioncof.views.profile'),
url(r'^outsider/password-change$',
'django.contrib.auth.views.password_change'),
url(r'^outsider/password-change-done$',
'django.contrib.auth.views.password_change_done',
name='password_change_done'),
# Inscription d'un nouveau membre
url(r'^registration$', 'gestioncof.views.registration'),
url(r'^registration/clipper/(?P<login_clipper>[\w-]+)$',
'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"),
# Autocompletion
url(r'^autocomplete/registration$',
'gestioncof.autocomplete.autocomplete'),
url(r'^autocomplete/', include('autocomplete_light.urls')),
# Interface admin
url(r'^admin/logout/', 'gestioncof.views.logout'),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/(?P<app_label>[\d\w]+)/(?P<model_name>[\d\w]+)/csv/',
'gestioncof.csv_views.admin_list_export',
{'fields': ['username', ]}),
url(r'^admin/', include(admin.site.urls)),
url(r'^grappelli/', include('grappelli.urls')),
# Liens utiles du COF et du BdA
url(r'^utile_cof$', 'gestioncof.views.utile_cof'),
url(r'^utile_bda$', 'gestioncof.views.utile_bda'),
url(r'^utile_bda/bda_diff$', 'gestioncof.views.liste_bdadiff'),
url(r'^utile_cof/diff_cof$', 'gestioncof.views.liste_diffcof'),
url(r'^utile_bda/bda_revente$', 'gestioncof.views.liste_bdarevente'),
) + \
(static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if settings.DEBUG
else [])
# 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.