From 1f8339b4dbff2ad0049bb652e846c04d52575db4 Mon Sep 17 00:00:00 2001 From: Qwann Date: Tue, 21 Feb 2017 16:56:34 +0100 Subject: [PATCH 1/2] renaming `user` into `users` --- evenementiel/settings_dev.py | 2 +- evenementiel/urls.py | 2 +- shared/templates/base.html | 10 +++--- shared/templates/base_nav.html | 6 ++-- user/apps.py | 5 --- user/migrations/0001_initial.py | 26 -------------- user/migrations/0002_auto_20160616_1803.py | 35 ------------------- user/migrations/0003_auto_20160623_1603.py | 31 ---------------- user/migrations/0004_auto_20160623_1808.py | 22 ------------ user/migrations/__init__.py | 0 user/templates/user/change_pass.html | 4 --- user/templates/user/password_reset.html | 4 --- .../templates/user/subject_password_reset.txt | 1 - {user => users}/__init__.py | 0 {user => users}/admin.py | 0 users/apps.py | 5 +++ {user => users}/forms.py | 0 {user => users}/models.py | 0 users/templates/users/change_pass.html | 4 +++ .../users}/email_password_reset.html | 2 +- .../user => users/templates/users}/login.html | 4 +-- users/templates/users/password_reset.html | 4 +++ .../users/subject_password_reset.txt | 1 + .../templates/users}/user_form.html | 0 {user => users}/tests.py | 0 {user => users}/urls.py | 14 ++++---- {user => users}/views.py | 4 +-- 27 files changed, 36 insertions(+), 150 deletions(-) delete mode 100644 user/apps.py delete mode 100644 user/migrations/0001_initial.py delete mode 100644 user/migrations/0002_auto_20160616_1803.py delete mode 100644 user/migrations/0003_auto_20160623_1603.py delete mode 100644 user/migrations/0004_auto_20160623_1808.py delete mode 100644 user/migrations/__init__.py delete mode 100644 user/templates/user/change_pass.html delete mode 100644 user/templates/user/password_reset.html delete mode 100644 user/templates/user/subject_password_reset.txt rename {user => users}/__init__.py (100%) rename {user => users}/admin.py (100%) create mode 100644 users/apps.py rename {user => users}/forms.py (100%) rename {user => users}/models.py (100%) create mode 100644 users/templates/users/change_pass.html rename {user/templates/user => users/templates/users}/email_password_reset.html (74%) rename {user/templates/user => users/templates/users}/login.html (66%) create mode 100644 users/templates/users/password_reset.html create mode 100644 users/templates/users/subject_password_reset.txt rename {user/templates/user => users/templates/users}/user_form.html (100%) rename {user => users}/tests.py (100%) rename {user => users}/urls.py (86%) rename {user => users}/views.py (87%) diff --git a/evenementiel/settings_dev.py b/evenementiel/settings_dev.py index 2fa8a01..1f0138f 100644 --- a/evenementiel/settings_dev.py +++ b/evenementiel/settings_dev.py @@ -35,7 +35,7 @@ ALLOWED_HOSTS = [] INSTALLED_APPS = [ 'equipment.apps.EquipmentConfig', 'event.apps.EventConfig', - 'user.apps.UserConfig', + 'users.apps.UsersConfig', 'shared.apps.SharedConfig', 'django.contrib.admin', 'django.contrib.auth', diff --git a/evenementiel/urls.py b/evenementiel/urls.py index eff7989..ee8de46 100644 --- a/evenementiel/urls.py +++ b/evenementiel/urls.py @@ -8,7 +8,7 @@ from django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^event/', include('event.urls')), - url(r'^user/', include('user.urls')), + url(r'^user/', include('users.urls')), url(r'^', include('shared.urls')), ] diff --git a/shared/templates/base.html b/shared/templates/base.html index ac763ba..0b52928 100644 --- a/shared/templates/base.html +++ b/shared/templates/base.html @@ -20,19 +20,19 @@ {% block sidenav %} {% if not user.is_authenticated %}
  • - + Se connecter
  • - + Créer un compte
  • - + Mot de passe oublié @@ -40,13 +40,13 @@ {% endif %} {% if user.is_authenticated %}
  • - + Changer de mot de passe
  • - + Se déconnecter diff --git a/shared/templates/base_nav.html b/shared/templates/base_nav.html index 57a059a..2763935 100644 --- a/shared/templates/base_nav.html +++ b/shared/templates/base_nav.html @@ -69,10 +69,10 @@ @@ -80,7 +80,7 @@ {% else %}
  • - +
  • {% endif %} diff --git a/user/apps.py b/user/apps.py deleted file mode 100644 index 35048d4..0000000 --- a/user/apps.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.apps import AppConfig - - -class UserConfig(AppConfig): - name = 'user' diff --git a/user/migrations/0001_initial.py b/user/migrations/0001_initial.py deleted file mode 100644 index 04a012f..0000000 --- a/user/migrations/0001_initial.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.6 on 2016-06-14 22:17 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.CreateModel( - name='Profil', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/user/migrations/0002_auto_20160616_1803.py b/user/migrations/0002_auto_20160616_1803.py deleted file mode 100644 index 4193a65..0000000 --- a/user/migrations/0002_auto_20160616_1803.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.6 on 2016-06-16 16:03 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('user', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='profil', - name='modif_pad', - field=models.BooleanField(default=False, verbose_name='Modifier tous les pads'), - ), - migrations.AddField( - model_name='profil', - name='read_kholle', - field=models.BooleanField(default=False, verbose_name='Lecture de khôlles'), - ), - migrations.AddField( - model_name='profil', - name='write_kholle', - field=models.BooleanField(default=False, verbose_name='Écriture de khôlles'), - ), - migrations.AddField( - model_name='profil', - name='write_pad', - field=models.BooleanField(default=False, verbose_name='Écrire des pads'), - ), - ] diff --git a/user/migrations/0003_auto_20160623_1603.py b/user/migrations/0003_auto_20160623_1603.py deleted file mode 100644 index 401255c..0000000 --- a/user/migrations/0003_auto_20160623_1603.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.6 on 2016-06-23 14:03 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('user', '0002_auto_20160616_1803'), - ] - - operations = [ - migrations.RemoveField( - model_name='profil', - name='modif_pad', - ), - migrations.RemoveField( - model_name='profil', - name='read_kholle', - ), - migrations.RemoveField( - model_name='profil', - name='write_kholle', - ), - migrations.RemoveField( - model_name='profil', - name='write_pad', - ), - ] diff --git a/user/migrations/0004_auto_20160623_1808.py b/user/migrations/0004_auto_20160623_1808.py deleted file mode 100644 index d2c52e2..0000000 --- a/user/migrations/0004_auto_20160623_1808.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.6 on 2016-06-23 16:08 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('user', '0003_auto_20160623_1603'), - ] - - operations = [ - migrations.RemoveField( - model_name='profil', - name='user', - ), - migrations.DeleteModel( - name='Profil', - ), - ] diff --git a/user/migrations/__init__.py b/user/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/user/templates/user/change_pass.html b/user/templates/user/change_pass.html deleted file mode 100644 index ff663aa..0000000 --- a/user/templates/user/change_pass.html +++ /dev/null @@ -1,4 +0,0 @@ -{% extends "user/user_form.html" %} - -{% block action_name %}{% url 'user:password_change' %}{% endblock %} -{% block user_error %}Une erreur s'est produite, veuillez réessayer.{% endblock %} diff --git a/user/templates/user/password_reset.html b/user/templates/user/password_reset.html deleted file mode 100644 index 799ab8e..0000000 --- a/user/templates/user/password_reset.html +++ /dev/null @@ -1,4 +0,0 @@ -{% extends "user/user_form.html" %} - -{% block action_name %}{% url 'user:password_reset' %}{% endblock %} -{% block user_error %}L'identitfiant et le mot de passe ne correspondent pas !{% endblock %} diff --git a/user/templates/user/subject_password_reset.txt b/user/templates/user/subject_password_reset.txt deleted file mode 100644 index 68bd26c..0000000 --- a/user/templates/user/subject_password_reset.txt +++ /dev/null @@ -1 +0,0 @@ -[Qwann.fr] Réinitialisation du mot de passe diff --git a/user/__init__.py b/users/__init__.py similarity index 100% rename from user/__init__.py rename to users/__init__.py diff --git a/user/admin.py b/users/admin.py similarity index 100% rename from user/admin.py rename to users/admin.py diff --git a/users/apps.py b/users/apps.py new file mode 100644 index 0000000..4ce1fab --- /dev/null +++ b/users/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class UsersConfig(AppConfig): + name = 'users' diff --git a/user/forms.py b/users/forms.py similarity index 100% rename from user/forms.py rename to users/forms.py diff --git a/user/models.py b/users/models.py similarity index 100% rename from user/models.py rename to users/models.py diff --git a/users/templates/users/change_pass.html b/users/templates/users/change_pass.html new file mode 100644 index 0000000..d022018 --- /dev/null +++ b/users/templates/users/change_pass.html @@ -0,0 +1,4 @@ +{% extends "users/user_form.html" %} + +{% block action_name %}{% url 'users:password_change' %}{% endblock %} +{% block user_error %}Une erreur s'est produite, veuillez réessayer.{% endblock %} diff --git a/user/templates/user/email_password_reset.html b/users/templates/users/email_password_reset.html similarity index 74% rename from user/templates/user/email_password_reset.html rename to users/templates/users/email_password_reset.html index d9dbd1a..8bdaf45 100644 --- a/user/templates/user/email_password_reset.html +++ b/users/templates/users/email_password_reset.html @@ -1,6 +1,6 @@ Bonjour, Quelqu'un a demandé à réinitialiser le mot de passe pour le compte utilisateur de qwann.fr utilisant l'adresse mail : {{ email }}. Pour réinitialiser le mot de passe, veuillez suivre le lien suivant : -{{ protocol}}://qwann.fr{% url 'user:password_reset_confirm' uidb64=uid token=token %} +{{ protocol}}://qwann.fr{% url 'users:password_reset_confirm' uidb64=uid token=token %} Merci de ne pas répondre à ce mail. diff --git a/user/templates/user/login.html b/users/templates/users/login.html similarity index 66% rename from user/templates/user/login.html rename to users/templates/users/login.html index 5cdbef5..90b2fed 100644 --- a/user/templates/user/login.html +++ b/users/templates/users/login.html @@ -1,6 +1,6 @@ -{% extends "user/user_form.html" %} +{% extends "users/user_form.html" %} -{% block action_name %}{% url 'user:login' %}{% endblock %} +{% block action_name %}{% url 'users:login' %}{% endblock %} {% block user_error %}L'identitfiant et le mot de passe ne correspondent pas !{% endblock %} {% block extra_form_input %} diff --git a/users/templates/users/password_reset.html b/users/templates/users/password_reset.html new file mode 100644 index 0000000..2847c99 --- /dev/null +++ b/users/templates/users/password_reset.html @@ -0,0 +1,4 @@ +{% extends "users/user_form.html" %} + +{% block action_name %}{% url 'users:password_reset' %}{% endblock %} +{% block user_error %}L'identitfiant et le mot de passe ne correspondent pas !{% endblock %} diff --git a/users/templates/users/subject_password_reset.txt b/users/templates/users/subject_password_reset.txt new file mode 100644 index 0000000..a0be86b --- /dev/null +++ b/users/templates/users/subject_password_reset.txt @@ -0,0 +1 @@ +[Évenementiel] Réinitialisation du mot de passe diff --git a/user/templates/user/user_form.html b/users/templates/users/user_form.html similarity index 100% rename from user/templates/user/user_form.html rename to users/templates/users/user_form.html diff --git a/user/tests.py b/users/tests.py similarity index 100% rename from user/tests.py rename to users/tests.py diff --git a/user/urls.py b/users/urls.py similarity index 86% rename from user/urls.py rename to users/urls.py index bcf5fcb..9911e1f 100644 --- a/user/urls.py +++ b/users/urls.py @@ -2,16 +2,16 @@ from django.conf.urls import url from django.contrib.auth import views as auth_views from django.core.urlresolvers import reverse_lazy from shared.views import Home -from user.views import CreateUser +from users.views import CreateUser -app_name = 'user' +app_name = 'users' urlpatterns = [ # CREATE USER url('^create/$', CreateUser.as_view(), name='create_user'), # LOGIN url('^login/$', auth_views.login, - {'template_name': 'user/login.html', + {'template_name': 'users/login.html', 'extra_context': { 'page_title': 'Connexion', 'button': 'Se connecter', @@ -28,7 +28,7 @@ urlpatterns = [ # PASSWORD_CHANGE url('^password_change/$', auth_views.password_change, - {'template_name': 'user/change_pass.html', + {'template_name': 'users/change_pass.html', 'post_change_redirect': reverse_lazy('shared:home'), 'extra_context': { 'page_title': 'Changement de mot de passe', @@ -40,10 +40,10 @@ urlpatterns = [ # RESET PASSWORD url('^password_reset/$', auth_views.password_reset, - {'template_name': 'user/password_reset.html', + {'template_name': 'users/password_reset.html', 'email_template_name': 'email_password_reset.html', 'subject_template_name': 'subject_password_reset.txt', - 'post_reset_redirect': reverse_lazy('user:password_reset_done'), + 'post_reset_redirect': reverse_lazy('users:password_reset_done'), 'extra_context': { 'page_title': 'Demander un nouveau mot de passe', 'button': 'Envoyer' @@ -58,7 +58,7 @@ urlpatterns = [ 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', + 'template_name': 'users/user_form.html', 'post_reset_redirect': reverse_lazy('user:password_reset_complete'), 'extra_context': { 'page_title': 'Changer de mot de passe', diff --git a/user/views.py b/users/views.py similarity index 87% rename from user/views.py rename to users/views.py index dd5a9e1..4b2ae3f 100644 --- a/user/views.py +++ b/users/views.py @@ -1,10 +1,10 @@ -from user.forms import CreateUserForm +from .forms import CreateUserForm 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' + template_name = 'users/user_form.html' form_class = CreateUserForm success_url = reverse_lazy('erkan:index') success_message = "Votre compte utilisateur a été correctement créé !" -- 2.47.0 From a41d2b99b2cab73312a65c8b1928ad75174e8cb1 Mon Sep 17 00:00:00 2001 From: Qwann Date: Tue, 21 Feb 2017 19:12:18 +0100 Subject: [PATCH 2/2] regexp urls --- users/urls.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/users/urls.py b/users/urls.py index 9911e1f..2b0bb37 100644 --- a/users/urls.py +++ b/users/urls.py @@ -7,9 +7,9 @@ from users.views import CreateUser app_name = 'users' urlpatterns = [ # CREATE USER - url('^create/$', CreateUser.as_view(), name='create_user'), + url(r'^create/$', CreateUser.as_view(), name='create_user'), # LOGIN - url('^login/$', + url(r'^login/$', auth_views.login, {'template_name': 'users/login.html', 'extra_context': { @@ -20,13 +20,13 @@ urlpatterns = [ name='login', ), # LOGOUT - url('^logout/$', + url(r'^logout/$', auth_views.logout, {'next_page': reverse_lazy('shared:home'), }, name='logout',), # PASSWORD_CHANGE - url('^password_change/$', + url(r'^password_change/$', auth_views.password_change, {'template_name': 'users/change_pass.html', 'post_change_redirect': reverse_lazy('shared:home'), @@ -38,7 +38,7 @@ urlpatterns = [ name='password_change'), # url('^password_change/done/$', name='password_change_done'), # RESET PASSWORD - url('^password_reset/$', + url(r'^password_reset/$', auth_views.password_reset, {'template_name': 'users/password_reset.html', 'email_template_name': 'email_password_reset.html', @@ -51,11 +51,11 @@ urlpatterns = [ }, name='password_reset'), # PASS RESET DONE - url('^password_reset/done/$', + url(r'^password_reset/done/$', 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(r'^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': 'users/user_form.html', @@ -67,7 +67,7 @@ urlpatterns = [ }, name='password_reset_confirm'), # PASS RESET COMPLETE - url('^reset/done/$', + url(r'^reset/done/$', Home.as_view(), name='password_reset_complete'), ] -- 2.47.0