1 #!/usr/bin/python2.5 |
1 #!/usr/bin/python2.5 |
2 |
2 |
3 from django import forms |
3 from django import forms |
4 from pytask.taskapp.models import GENDER_CHOICES, Profile |
4 from pytask.taskapp.models import GENDER_CHOICES, Profile |
5 from django.forms import ModelForm |
5 from django.forms import ModelForm |
6 from registration.forms import RegistrationForm |
6 from registration.forms import RegistrationFormUniqueEmail |
7 from registration.models import RegistrationProfile |
7 from registration.models import RegistrationProfile |
8 |
8 |
9 class UserProfileEditForm(ModelForm): |
9 class UserProfileEditForm(ModelForm): |
10 """Form used to edit the profile of a user""" |
10 """Form used to edit the profile of a user""" |
11 |
11 |
12 class Meta: |
12 class Meta: |
13 model = Profile |
13 model = Profile |
14 exclude = ('user','rights','dob','credits') |
14 exclude = ('user','rights','dob','credits') |
15 |
15 |
16 class RegistrationFormCustom(RegistrationForm): |
16 class RegistrationFormCustom(RegistrationFormUniqueEmail): |
17 """Used instead of RegistrationForm used by default django-registration backend, this adds date of birth and gender to the default django-registration RegistrationForm""" |
17 """Used instead of RegistrationForm used by default django-registration backend, this adds date of birth and gender to the default django-registration RegistrationForm""" |
18 |
18 |
19 dob = forms.DateField(help_text = "YYYY-MM-DD", required=True, label=u'date of birth') |
19 dob = forms.DateField(help_text = "YYYY-MM-DD", required=True, label=u'date of birth') |
20 gender = forms.ChoiceField(choices = GENDER_CHOICES, required=True, label=u'gender') |
20 gender = forms.ChoiceField(choices = GENDER_CHOICES, required=True, label=u'gender') |
21 |
21 |