summaryrefslogtreecommitdiff
path: root/yaksh/forms.py
diff options
context:
space:
mode:
authoradityacp2016-05-06 23:45:16 +0530
committeradityacp2016-05-12 10:33:31 +0530
commit88db9b2451693ab832a9d8c0abcad0a452b3500d (patch)
treef26a01598055b4b58cfaec0e15916a1c7295c4cd /yaksh/forms.py
parent5c74697b00ea08a2b78615637d8b322410fca4b0 (diff)
downloadonline_test-88db9b2451693ab832a9d8c0abcad0a452b3500d.tar.gz
online_test-88db9b2451693ab832a9d8c0abcad0a452b3500d.tar.bz2
online_test-88db9b2451693ab832a9d8c0abcad0a452b3500d.zip
display datetime as per user timezone
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r--yaksh/forms.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py
index 808262b..34b87d4 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,7 @@ 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])
def clean_username(self):
u_name = self.cleaned_data["username"]
@@ -118,6 +120,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 +211,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)