plateforme-tfjm2/apps/member/forms.py

61 lines
1.8 KiB
Python
Raw Normal View History

2020-04-29 13:29:01 +00:00
from django.contrib.auth.forms import UserCreationForm
2020-05-04 18:21:53 +00:00
from django import forms
2020-04-29 13:29:01 +00:00
from django.utils.translation import gettext_lazy as _
from member.models import TFJMUser
class SignUpForm(UserCreationForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["first_name"].required = True
self.fields["last_name"].required = True
self.fields["role"].choices = [
('', _("Choose a role...")),
('participant', _("Participant")),
('encadrant', _("Encadrant")),
]
class Meta:
model = TFJMUser
fields = (
'role',
'email',
'first_name',
'last_name',
'birth_date',
'gender',
'address',
'postal_code',
'city',
'country',
'phone_number',
'school',
'student_class',
'responsible_name',
'responsible_phone',
'responsible_email',
'description',
)
2020-05-04 18:21:53 +00:00
class TFJMUserForm(forms.ModelForm):
class Meta:
model = TFJMUser
2020-05-04 23:04:07 +00:00
fields = ('last_name', 'first_name', 'email', 'phone_number', 'gender', 'birth_date', 'address', 'postal_code',
'city', 'country', 'school', 'student_class', 'responsible_name', 'responsible_phone',
'responsible_email',)
class CoachUserForm(forms.ModelForm):
class Meta:
model = TFJMUser
fields = ('last_name', 'first_name', 'email', 'phone_number', 'gender', 'birth_date', 'address', 'postal_code',
'city', 'country', 'description',)
class AdminUserForm(forms.ModelForm):
class Meta:
model = TFJMUser
fields = ('last_name', 'first_name', 'email', 'phone_number', 'description',)