Commit 813f73a6 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by root

Réécriture des url sans la fonction patterns

parent e42b8b55
# -*- encoding: utf-8 -*-
from django.conf.urls import include, patterns, url
from django.conf.urls import include, url
from intranet import settings
import django.contrib.auth.views
from django.views.decorators.debug import sensitive_post_parameters
from django_cas_ng.views import login, logout
from intranet.views import accueil, surlogin, surlogout
import bw_comp
from django.contrib import admin
admin.autodiscover()
......@@ -12,8 +15,8 @@ if settings.CAS_ENABLED:
from django_cas_ng.signals import cas_user_authenticated
from intranet.login import post_cas_login
cas_user_authenticated.connect(post_cas_login)
login_url = url(r'^login$', 'django_cas_ng.views.login', name="login")
logout_url = url(r'^logout$', 'django_cas_ng.views.logout', name="logout")
login_url = url(r'^login$', login, name="login")
logout_url = url(r'^logout$', logout, name="logout")
else:
login_view = django.contrib.auth.views.login
login_view = sensitive_post_parameters('password')(login_view)
......@@ -21,25 +24,25 @@ else:
#login_url = url('^login', protect(django.contrib.auth.views.login), {'template_name': 'login.html'}, name="login")
logout_url = url('^logout', 'django.contrib.auth.views.logout_then_login', name ="logout")
urlpatterns = patterns('',
urlpatterns = [
# Les pages existantes
url('^$', 'intranet.views.accueil', name='index'),
url('^surlogin$', 'intranet.views.surlogin', name='surlogin'),
url('^surlogout$', 'intranet.views.surlogout', name='surlogout'),
url('^$', accueil, name='index'),
url('^surlogin$', surlogin, name='surlogin'),
url('^surlogout$', surlogout, name='surlogout'),
# Pages de login
login_url,
logout_url,
(r'^admin/', include(admin.site.urls)),
(r'^heartbeat$', 'bw_comp.heartbeat.view'),
url(r'^admin/', include(admin.site.urls)),
#(r'^heartbeat$', bw_comp.heartbeat.view),
url(r'^i18n/', include('django.conf.urls.i18n')),
)
]
for app in settings.INTRANET_APPS:
app_name = app["name"]
module = app.get('module', app_name)
urlpatterns += patterns('', ('^%s/' % app_name, include('%s.urls' % module,
urlpatterns += [url('^%s/' % app_name, include('%s.urls' % module,
namespace = app_name,
app_name = app_name)))
app_name = app_name))]
# Pour une raison inconnue, ces valeurs par défaut ne sont pas définies ...
handler404='django.views.defaults.page_not_found'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment