forked from DGNum/gestioCOF
Fix sur les noms d'utilisateurs
À l'inscription on contraint les noms d'utilisateurs à dépasser 8 caractères seulement à la création de nouveaux utilisateurs pour garantir la rétrocompatibilité.
This commit is contained in:
parent
ac0748d0a4
commit
9258f509ee
1 changed files with 3 additions and 1 deletions
|
@ -200,9 +200,11 @@ class UserProfileForm(forms.ModelForm):
|
||||||
|
|
||||||
class RegistrationUserForm(forms.ModelForm):
|
class RegistrationUserForm(forms.ModelForm):
|
||||||
def __init__(self, *args, **kw):
|
def __init__(self, *args, **kw):
|
||||||
|
new_user = kw.get('instance') is None
|
||||||
super(RegistrationUserForm, self).__init__(*args, **kw)
|
super(RegistrationUserForm, self).__init__(*args, **kw)
|
||||||
self.fields['username'].help_text = ""
|
self.fields['username'].help_text = ""
|
||||||
self.fields['username'].validators = [MinLengthValidator(9)]
|
if new_user:
|
||||||
|
self.fields['username'].validators = [MinLengthValidator(9)]
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
|
|
Loading…
Reference in a new issue