summaryrefslogtreecommitdiff
path: root/yaksh/forms.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-05-27 12:32:21 +0530
committerPrabhu Ramachandran2016-05-27 12:32:21 +0530
commit033d116bc803fe165cbe6f7e228c29d8f0b019a9 (patch)
tree6553297f4855810eb349916a4a5947a1f88c4fb2 /yaksh/forms.py
parent5c74697b00ea08a2b78615637d8b322410fca4b0 (diff)
parent7b762b4550f08b95c1ebf8196bd79c3f77a306ca (diff)
downloadonline_test-033d116bc803fe165cbe6f7e228c29d8f0b019a9.tar.gz
online_test-033d116bc803fe165cbe6f7e228c29d8f0b019a9.tar.bz2
online_test-033d116bc803fe165cbe6f7e228c29d8f0b019a9.zip
Merge pull request #99 from adityacp/fix_timezone
Fix timezone
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r--yaksh/forms.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py
index 808262b..26e0967 100644
--- a/yaksh/forms.py
+++ b/yaksh/forms.py
@@ -11,6 +11,7 @@ from django.forms.models import inlineformset_factory
from django.db.models import Q
from string import letters, punctuation, digits
import datetime
+import pytz
languages = (
("select", "Select Language"),
@@ -73,6 +74,8 @@ class UserRegisterForm(forms.Form):
(max_length=64, help_text='Department you work/study at')
position = forms.CharField\
(max_length=64, help_text='Student/Faculty/Researcher/Industry/etc.')
+ timezone = forms.ChoiceField(choices=[(tz, tz) for tz in pytz.common_timezones],
+ initial=pytz.utc)
def clean_username(self):
u_name = self.cleaned_data["username"]
@@ -118,6 +121,7 @@ class UserRegisterForm(forms.Form):
new_profile.institute = cleaned_data["institute"]
new_profile.department = cleaned_data["department"]
new_profile.position = cleaned_data["position"]
+ new_profile.timezone = cleaned_data["timezone"]
new_profile.save()
return u_name, pwd
@@ -208,7 +212,7 @@ class ProfileForm(forms.ModelForm):
class Meta:
model = Profile
fields = ['first_name', 'last_name', 'institute',
- 'department', 'roll_number', 'position']
+ 'department', 'roll_number', 'position', 'timezone']
first_name = forms.CharField(max_length=30)
last_name = forms.CharField(max_length=30)