From 88db9b2451693ab832a9d8c0abcad0a452b3500d Mon Sep 17 00:00:00 2001 From: adityacp Date: Fri, 6 May 2016 23:45:16 +0530 Subject: display datetime as per user timezone --- yaksh/forms.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'yaksh/forms.py') 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) -- cgit From c1cd00f34341e06dce7610fa5da42d68b531bd92 Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 12 May 2016 11:27:57 +0530 Subject: rebase changes and comments changes --- yaksh/forms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'yaksh/forms.py') diff --git a/yaksh/forms.py b/yaksh/forms.py index 34b87d4..26e0967 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -74,7 +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]) + 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"] -- cgit