forked from DGNum/gestioCOF
Clipper logins may be > 8 characters
This commit is contained in:
parent
387edd2fd5
commit
51f4bf3fb5
5 changed files with 27 additions and 19 deletions
|
@ -3,7 +3,6 @@
|
|||
from decimal import Decimal
|
||||
from django import forms
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import MinLengthValidator
|
||||
from django.contrib.auth.models import User, Group, Permission
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.forms import modelformset_factory
|
||||
|
@ -105,21 +104,16 @@ class CofRestrictForm(CofForm):
|
|||
class Meta(CofForm.Meta):
|
||||
fields = ['departement']
|
||||
|
||||
class UserForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
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)]
|
||||
|
||||
class UserForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = User
|
||||
model = User
|
||||
fields = ['username', 'first_name', 'last_name', 'email']
|
||||
help_texts = {
|
||||
'username': ''
|
||||
}
|
||||
|
||||
|
||||
class UserRestrictForm(UserForm):
|
||||
class Meta(UserForm.Meta):
|
||||
fields = ['first_name', 'last_name']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue