From cdf5fbb28550d10aea400029b9d5a9b037ea4ed3 Mon Sep 17 00:00:00 2001 From: Qwann Date: Tue, 21 Feb 2017 16:02:23 +0100 Subject: [PATCH] specifying home as... home in urls --- evenementiel/settings_dev.py | 3 +++ shared/views.py | 6 ++++-- user/urls.py | 14 +++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/evenementiel/settings_dev.py b/evenementiel/settings_dev.py index 7a05f58..2fa8a01 100644 --- a/evenementiel/settings_dev.py +++ b/evenementiel/settings_dev.py @@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os +from django.core.urlresolvers import reverse_lazy # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -61,6 +62,8 @@ MIDDLEWARE_CLASSES = [ ROOT_URLCONF = 'evenementiel.urls' +LOGIN_REDIRECT_URL = reverse_lazy('shared:home') + STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'shared/static/'), ] diff --git a/shared/views.py b/shared/views.py index 91ea44a..e93b5fd 100644 --- a/shared/views.py +++ b/shared/views.py @@ -1,3 +1,5 @@ -from django.shortcuts import render +from django.views.generic import TemplateView -# Create your views here. + +class Home(TemplateView): + template_name = "home.html" diff --git a/user/urls.py b/user/urls.py index 4783ca0..bcf5fcb 100644 --- a/user/urls.py +++ b/user/urls.py @@ -1,7 +1,7 @@ from django.conf.urls import url from django.contrib.auth import views as auth_views from django.core.urlresolvers import reverse_lazy -from event.views import Index # TODO : mettre le vrai home +from shared.views import Home from user.views import CreateUser app_name = 'user' @@ -22,16 +22,14 @@ urlpatterns = [ # LOGOUT url('^logout/$', auth_views.logout, - # TODO : mettre le vrai home - {'next_page': reverse_lazy('event:index'), + {'next_page': reverse_lazy('shared:home'), }, name='logout',), # PASSWORD_CHANGE url('^password_change/$', auth_views.password_change, {'template_name': 'user/change_pass.html', - # TODO : mettre le vrai home - 'post_change_redirect': reverse_lazy('event:index'), + 'post_change_redirect': reverse_lazy('shared:home'), 'extra_context': { 'page_title': 'Changement de mot de passe', 'button': 'Modifier', @@ -54,8 +52,7 @@ urlpatterns = [ name='password_reset'), # PASS RESET DONE url('^password_reset/done/$', - # TODO : mettre le vrai home - Index.as_view(), + Home.as_view(), name='password_reset_done'), # PASS RESET CONFIRM url('^reset/(?P[0-9A-Za-z_\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', @@ -71,7 +68,6 @@ urlpatterns = [ name='password_reset_confirm'), # PASS RESET COMPLETE url('^reset/done/$', - # TODO : mettre le vrai home - Index.as_view(), + Home.as_view(), name='password_reset_complete'), ]