added birth date & sex to user model
This commit is contained in:
@@ -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):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user