forked from DGNum/gestioCOF
initial
This commit is contained in:
parent
a2177155a0
commit
43d938edd0
20 changed files with 1053 additions and 0 deletions
36
kfet/forms.py
Normal file
36
kfet/forms.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
from django import forms
|
||||
from django.contrib.auth.models import User
|
||||
from kfet.models import Account
|
||||
from gestioncof.models import CofProfile
|
||||
|
||||
class AccountTrigrammeForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Account
|
||||
fields = ['trigramme']
|
||||
widgets = {
|
||||
'trigramme': forms.TextInput(attrs={'autocomplete': 'off'}),
|
||||
}
|
||||
|
||||
class AccountForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Account
|
||||
fields = ['promo', 'nickname']
|
||||
|
||||
class CofForm(forms.ModelForm):
|
||||
def clean_is_cof(self):
|
||||
instance = getattr(self, 'instance', None)
|
||||
if instance and instance.pk:
|
||||
return instance.is_cof
|
||||
else:
|
||||
return False
|
||||
class Meta:
|
||||
model = CofProfile
|
||||
fields = ['login_clipper', 'is_cof', 'departement']
|
||||
|
||||
class UserForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ['username', 'first_name', 'last_name', 'email']
|
||||
help_texts = {
|
||||
'username': ''
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue