Private
Public Access
1
0

added birth date & sex to user model

This commit is contained in:
Sander Roosendaal
2017-12-07 08:39:13 +01:00
parent 59a2efb7dc
commit 2f7fcf444b
3 changed files with 64 additions and 5 deletions

View File

@@ -354,6 +354,7 @@ class RegistrationFormTermsOfService(RegistrationForm):
tos = forms.BooleanField(widget=forms.CheckboxInput,
label='I have read and agree to the Terms of Service',
error_messages={'required': "You must agree to the terms to register"})
class RegistrationFormUniqueEmail(RegistrationFormTermsOfService):
@@ -370,6 +371,35 @@ class RegistrationFormUniqueEmail(RegistrationFormTermsOfService):
raise forms.ValidationError("This email address is already in use. Please supply a different email address.")
return self.cleaned_data['email']
class RegistrationFormSex(RegistrationFormUniqueEmail):
sexcategories = (
('female','female'),
('male','male'),
('not specified','not specified'),
)
weightcategories = (
('hwt','heavy-weight'),
('lwt','light-weight'),
)
birthdate = forms.DateTimeField(widget=SelectDateWidget(
years=range(timezone.now().year-100,timezone.now().year-10)),
initial = datetime.date(year=1970,
month=4,
day=15))
sex = forms.ChoiceField(required=True,
choices=sexcategories,
initial='not specified',
label='Sex')
weightcategory = forms.ChoiceField(label='Weight Category',
choices=weightcategories)
# def __init__(self, *args, **kwargs):
# self.fields['sex'].initial = 'not specified'
# Time field supporting microseconds. Not used, I believe.
class MyTimeField(forms.TimeField):