forked from DGNum/gestioCOF
Correction du dernier commit
This commit is contained in:
parent
9258f509ee
commit
da07f34b51
2 changed files with 7 additions and 4 deletions
|
@ -200,11 +200,11 @@ class UserProfileForm(forms.ModelForm):
|
|||
|
||||
class RegistrationUserForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kw):
|
||||
new_user = kw.get('instance') is None
|
||||
super(RegistrationUserForm, self).__init__(*args, **kw)
|
||||
self.fields['username'].help_text = ""
|
||||
if new_user:
|
||||
self.fields['username'].validators = [MinLengthValidator(9)]
|
||||
|
||||
def force_long_username(self):
|
||||
self.fields['username'].validators = [MinLengthValidator(9)]
|
||||
|
||||
class Meta:
|
||||
model = User
|
||||
|
|
|
@ -364,6 +364,7 @@ def registration_form2(request, login_clipper=None, username=None):
|
|||
elif not login_clipper:
|
||||
# new user
|
||||
user_form = RegistrationPassUserForm()
|
||||
user_form.force_long_username()
|
||||
profile_form = RegistrationProfileForm()
|
||||
event_formset = EventFormset(events=events, prefix='events')
|
||||
return render(request, "registration_form.html",
|
||||
|
@ -405,7 +406,9 @@ def registration(request):
|
|||
clipper = Clipper.objects.get(username=username)
|
||||
login_clipper = clipper.username
|
||||
except Clipper.DoesNotExist:
|
||||
pass
|
||||
user_form.force_long_username()
|
||||
else:
|
||||
user_form.force_long_username()
|
||||
|
||||
# -----
|
||||
# Validation des formulaires
|
||||
|
|
Loading…
Reference in a new issue