aboutsummaryrefslogtreecommitdiffstats
path: root/account/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'account/forms.py')
-rw-r--r--account/forms.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/account/forms.py b/account/forms.py
new file mode 100644
index 0000000..6a566e9
--- /dev/null
+++ b/account/forms.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+
+"""
+account/forms.py for skaschool
+"""
+
+from django import forms
+from registration.forms import RegistrationFormUniqueEmail
+from django.utils.translation import ugettext_lazy as _
+
+
+class UserRegForm(RegistrationFormUniqueEmail):
+ """
+ based on 'django-registration' RegistrationFormUniqueEmail
+ add fields 'realname', 'gender', 'institute' and 'captcha'
+ """
+ # XXX: keep consistent with GENDERS in 'models.UserProfile'
+ GENDERS = (
+ ('M', _("Male")),
+ ('F', _("Female")),
+ ('X', _("Secret")),
+ )
+ realname = forms.CharField(max_length=30, label=_("Name"))
+ gender = forms.ChoiceField(choices=GENDERS, label=_("Gender"))
+ institute = forms.CharField(max_length=100, label=_("Institute"))
+
+ def __init__(self, *args, **kw):
+ super(UserRegForm, self).__init__(*args, **kw)
+ # order form fields
+ self.fields.keyOrder = [
+ 'username',
+ 'email',
+ 'password1',
+ 'password2',
+ 'realname',
+ 'gender',
+ 'institute',
+ ]
+
+