From 9534771cd9836bb379503a6896e233b8d3ab4e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Thu, 1 Sep 2016 05:01:59 +0200 Subject: [PATCH] Rework account create - Affichage des erreurs en cas... d'erreurs ! --- kfet/forms.py | 3 +- kfet/templates/kfet/account_create.html | 7 +- kfet/templates/kfet/account_create_form.html | 1 - kfet/views.py | 171 +++++++++++-------- 4 files changed, 105 insertions(+), 77 deletions(-) diff --git a/kfet/forms.py b/kfet/forms.py index 0ec3b114..ad2814c9 100644 --- a/kfet/forms.py +++ b/kfet/forms.py @@ -83,7 +83,8 @@ class CofRestrictForm(CofForm): class UserForm(forms.ModelForm): def __init__(self, *args, **kwargs): - new_user = kwargs.get('instance') is None + from_clipper = kwargs.pop('from_clipper', False) + new_user = kwargs.get('instance') is None and not from_clipper super(UserForm, self).__init__(*args, **kwargs) if new_user: self.fields['username'].validators = [MinLengthValidator(9)] diff --git a/kfet/templates/kfet/account_create.html b/kfet/templates/kfet/account_create.html index 7d42b028..9da15755 100644 --- a/kfet/templates/kfet/account_create.html +++ b/kfet/templates/kfet/account_create.html @@ -14,11 +14,14 @@ {% include 'kfet/base_messages.html' %}
- {{ account_trigramme_form }} + {% csrf_token %} + {{ trigramme_form }}
-
+
+ {% include 'kfet/account_create_form.html' %} +