From 7b762b4550f08b95c1ebf8196bd79c3f77a306ca Mon Sep 17 00:00:00 2001 From: adityacp Date: Tue, 17 May 2016 12:59:24 +0530 Subject: comment changes --- yaksh/middleware/user_time_zone.py | 2 +- yaksh/models.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/yaksh/middleware/user_time_zone.py b/yaksh/middleware/user_time_zone.py index 3555d1f..f1aace9 100644 --- a/yaksh/middleware/user_time_zone.py +++ b/yaksh/middleware/user_time_zone.py @@ -9,7 +9,7 @@ class TimezoneMiddleware(object): def process_request(self, request): user = request.user if hasattr(user, 'profile'): - user_tz = user.profile.timezone + user_tz = user.profile.timezone timezone.activate(pytz.timezone(user_tz)) else: timezone.activate(pytz.timezone('UTC')) diff --git a/yaksh/models.py b/yaksh/models.py index dbe7892..6ee02e1 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -48,9 +48,6 @@ test_status = ( ('completed', 'Completed'), ) -# get current timezone info -tz = pytz.timezone(timezone.get_current_timezone_name()) - def get_assignment_dir(instance, filename): return '%s/%s' % (instance.user.roll_number, instance.assignmentQuestion.id) @@ -302,7 +299,9 @@ class Quiz(models.Model): # The end date and time of the quiz end_date_time = models.DateTimeField("End Date and Time of the quiz", - default=datetime(2199, 1, 1, tzinfo=tz), + default=datetime(2199, 1, 1, + tzinfo=pytz.timezone\ + (timezone.get_current_timezone_name())), null=True) # This is always in minutes. -- cgit