From 886f71fb5c6a9f3d5a3ec3da6f5f18bae6cb1e21 Mon Sep 17 00:00:00 2001 From: Qwann Date: Tue, 21 Feb 2017 15:32:03 +0100 Subject: [PATCH 1/8] creating 'empty' home view --- evenementiel/urls.py | 1 + shared/urls.py | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 shared/urls.py diff --git a/evenementiel/urls.py b/evenementiel/urls.py index 682df1e..eff7989 100644 --- a/evenementiel/urls.py +++ b/evenementiel/urls.py @@ -9,6 +9,7 @@ urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^event/', include('event.urls')), url(r'^user/', include('user.urls')), + url(r'^', include('shared.urls')), ] if settings.DEBUG: diff --git a/shared/urls.py b/shared/urls.py new file mode 100644 index 0000000..f591c4a --- /dev/null +++ b/shared/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls import url +from .views import Home + +app_name = 'shared' +urlpatterns = [ + url(r'$', Home.as_view(), name='home'), +] From cdf5fbb28550d10aea400029b9d5a9b037ea4ed3 Mon Sep 17 00:00:00 2001 From: Qwann Date: Tue, 21 Feb 2017 16:02:23 +0100 Subject: [PATCH 2/8] 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'), ] From 271fe8ecf13f99c8041b122027f11cbcb8658629 Mon Sep 17 00:00:00 2001 From: Qwann Date: Tue, 21 Feb 2017 16:27:29 +0100 Subject: [PATCH 3/8] defining default side nav --- shared/templates/base.html | 37 ++++++++++++++++++++++++++++- user/templates/user/base_user.html | 38 ------------------------------ user/templates/user/user_form.html | 2 +- 3 files changed, 37 insertions(+), 40 deletions(-) delete mode 100644 user/templates/user/base_user.html diff --git a/shared/templates/base.html b/shared/templates/base.html index 290a74d..ac763ba 100644 --- a/shared/templates/base.html +++ b/shared/templates/base.html @@ -16,9 +16,44 @@ {% endif %}
- + {% block sidenav %} + {% if not user.is_authenticated %} +
  • + + + Se connecter + +
  • +
  • + + + Créer un compte + +
  • +
  • + + + Mot de passe oublié + +
  • + {% endif %} + {% if user.is_authenticated %} +
  • + + + Changer de mot de passe + +
  • +
  • + + + Se déconnecter + +
  • + {% endif %} {% endblock %} + {% endblock %} {% block real_content %} diff --git a/user/templates/user/base_user.html b/user/templates/user/base_user.html deleted file mode 100644 index fa35902..0000000 --- a/user/templates/user/base_user.html +++ /dev/null @@ -1,38 +0,0 @@ -{% extends "base.html" %} - -{% block sidenav %} - {% if not user.is_authenticated %} -
  • - - - Se connecter - -
  • -
  • - - - Créer un compte - -
  • -
  • - - - Mot de passe oublié - -
  • - {% endif %} - {% if user.is_authenticated %} -
  • - - - Changer de mot de passe - -
  • -
  • - - - Se déconnecter - -
  • - {% endif %} -{% endblock %} diff --git a/user/templates/user/user_form.html b/user/templates/user/user_form.html index 8b5fb83..067564d 100644 --- a/user/templates/user/user_form.html +++ b/user/templates/user/user_form.html @@ -1,4 +1,4 @@ -{% extends "user/base_user.html" %} +{% extends "base.html" %} {% load widget_tweaks %} {% load bootstrap %} From d7049631d4e58342cc31c72ffb28f1b5312c7b93 Mon Sep 17 00:00:00 2001 From: Qwann Date: Tue, 21 Feb 2017 17:00:43 +0100 Subject: [PATCH 4/8] addng forgotten template cleaning `shared/template/` --- shared/templates/base.html.old | 75 ----------------------------- shared/templates/base_html.html.old | 71 --------------------------- shared/templates/home.html | 11 +++++ 3 files changed, 11 insertions(+), 146 deletions(-) delete mode 100644 shared/templates/base.html.old delete mode 100644 shared/templates/base_html.html.old create mode 100644 shared/templates/home.html diff --git a/shared/templates/base.html.old b/shared/templates/base.html.old deleted file mode 100644 index 757854e..0000000 --- a/shared/templates/base.html.old +++ /dev/null @@ -1,75 +0,0 @@ -{% extends "base_html.html" %} -{% load staticfiles %} - -{% block title %}Qwann{% block sub_title %}{% endblock %}{% endblock %} - -{% block navbar %} -
  • - {% if user.is_authenticated %} - - {% else %} - - {% endif %} -{% endblock %} - -{% block main_container %} -
    -
    -
    - {% if messages %} - {% for message in messages %} - - {% endfor %} - {% endif %} - {% block content %}{% endblock %} -
    - -
    -
    -{% endblock %} - -{% block foot %} -
    - -
    -{% endblock %} - -{% block foot_copyrights %} - La totalité du contenu de ce site est sous licence libre CC0. Plus d'infos. -{% endblock %} diff --git a/shared/templates/base_html.html.old b/shared/templates/base_html.html.old deleted file mode 100644 index 10c3633..0000000 --- a/shared/templates/base_html.html.old +++ /dev/null @@ -1,71 +0,0 @@ -{% load staticfiles %} - - - - - - {% block title %}{% endblock %} - - - - - - - - - - - - - - - - {% block extra_head %}{% endblock %} - - -
    -
    -
    - -
    -
    -
    -
    -

    {% block section_title %}{% endblock %}

    -
    -
    -
    -
    - {% block main_container %}{% endblock %} -
    -
    -
    - {% block foot %}{% endblock %} -
    -
    -
    - {% block foot_copyrights %}{% endblock %} -
    -
    -
    - {% block extra_script %}{% endblock %} - - - diff --git a/shared/templates/home.html b/shared/templates/home.html new file mode 100644 index 0000000..ec425b7 --- /dev/null +++ b/shared/templates/home.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} + +{% block page_title %}Acceuil{% endblock %} + +{% block content %} +

    Bonjours, je suis une maison

    + {% lorem 3 p %} +

    Looool

    + {% lorem 3 p %} +{% endblock %} + From f33db473a55b5689afe39a94635370eb207b7d25 Mon Sep 17 00:00:00 2001 From: Qwann Date: Tue, 21 Feb 2017 17:48:56 +0100 Subject: [PATCH 5/8] typo + PEP8 --- user/views.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/user/views.py b/user/views.py index dd5a9e1..b82cc16 100644 --- a/user/views.py +++ b/user/views.py @@ -3,13 +3,15 @@ from django.views.generic.edit import CreateView from django.contrib.messages.views import SuccessMessageMixin from django.core.urlresolvers import reverse_lazy + class CreateUser(SuccessMessageMixin, CreateView): - template_name = 'user/user_form.html' - form_class = CreateUserForm - success_url = reverse_lazy('erkan:index') + template_name = 'user/user_form.html' + form_class = CreateUserForm + success_url = reverse_lazy('shared:home') success_message = "Votre compte utilisateur a été correctement créé !" + def get_context_data(self, **kwargs): - ctx = super(CreateUser, self).get_context_data(**kwargs) - ctx['button'] = 'Créer' + ctx = super(CreateUser, self).get_context_data(**kwargs) + ctx['button'] = 'Créer' ctx['page_title'] = "Création d'utilisateur" return ctx From 7f2f995efd4196fc473d686d279c2db2ca42a671 Mon Sep 17 00:00:00 2001 From: Qwann Date: Tue, 21 Feb 2017 21:01:05 +0100 Subject: [PATCH 6/8] wrong merge fixed --- evenementiel/urls.py | 1 + 1 file changed, 1 insertion(+) diff --git a/evenementiel/urls.py b/evenementiel/urls.py index 32c17ee..eff7989 100644 --- a/evenementiel/urls.py +++ b/evenementiel/urls.py @@ -1,6 +1,7 @@ """ GestionEvenmentiel URL configuration """ +from django.conf import settings from django.conf.urls import url, include from django.contrib import admin From 7a4a836d6eac5b4f27a16cf0be0eb1573547cb81 Mon Sep 17 00:00:00 2001 From: Qwann Date: Wed, 26 Apr 2017 04:08:25 +0200 Subject: [PATCH 7/8] small fixes --- evenementiel/settings_dev.py | 1 + user/urls.py | 2 -- user/views.py | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/evenementiel/settings_dev.py b/evenementiel/settings_dev.py index 724846b..54f17a8 100644 --- a/evenementiel/settings_dev.py +++ b/evenementiel/settings_dev.py @@ -63,6 +63,7 @@ MIDDLEWARE_CLASSES = [ ROOT_URLCONF = 'evenementiel.urls' LOGIN_REDIRECT_URL = reverse_lazy('shared:home') +LOGOUT_REDIRECT_URL = reverse_lazy('shared:home') TEMPLATES = [ { diff --git a/user/urls.py b/user/urls.py index bcf5fcb..3295c69 100644 --- a/user/urls.py +++ b/user/urls.py @@ -22,8 +22,6 @@ urlpatterns = [ # LOGOUT url('^logout/$', auth_views.logout, - {'next_page': reverse_lazy('shared:home'), - }, name='logout',), # PASSWORD_CHANGE url('^password_change/$', diff --git a/user/views.py b/user/views.py index b82cc16..1860113 100644 --- a/user/views.py +++ b/user/views.py @@ -11,7 +11,7 @@ class CreateUser(SuccessMessageMixin, CreateView): success_message = "Votre compte utilisateur a été correctement créé !" def get_context_data(self, **kwargs): - ctx = super(CreateUser, self).get_context_data(**kwargs) + ctx = super().get_context_data(**kwargs) ctx['button'] = 'Créer' ctx['page_title'] = "Création d'utilisateur" return ctx From 704cd3e0fc06a66cc70dbd7f80caa588de6514d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Wed, 26 Apr 2017 20:36:22 +0100 Subject: [PATCH 8/8] PEP8 --- user/models.py | 1 - user/urls.py | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/user/models.py b/user/models.py index 4e54d78..85206e0 100644 --- a/user/models.py +++ b/user/models.py @@ -1,3 +1,2 @@ from django.db import models from django.contrib.auth.models import User - diff --git a/user/urls.py b/user/urls.py index 3295c69..13898b9 100644 --- a/user/urls.py +++ b/user/urls.py @@ -53,11 +53,14 @@ urlpatterns = [ 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})/$', + url('^reset/(?P[0-9A-Za-z_\-]+)/' + '(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', auth_views.password_reset_confirm, { 'template_name': 'user/user_form.html', - 'post_reset_redirect': reverse_lazy('user:password_reset_complete'), + 'post_reset_redirect': reverse_lazy( + 'user:password_reset_complete' + ), 'extra_context': { 'page_title': 'Changer de mot de passe', 'button': 'Changer'