summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-07-05 09:58:51 -0400
committerGitHub2016-07-05 09:58:51 -0400
commitc8dfe62663d715dcf4b571c1f738428165734d2a (patch)
tree71c7280c92fed8981f4e4df4c8b5ddfd6716ed33 /yaksh/views.py
parent660a8b4f8b21a1e5836536a9db755fcf840ecd63 (diff)
parente46028c511596e52495d64baed6fc53e11fb3b4a (diff)
downloadonline_test-c8dfe62663d715dcf4b571c1f738428165734d2a.tar.gz
online_test-c8dfe62663d715dcf4b571c1f738428165734d2a.tar.bz2
online_test-c8dfe62663d715dcf4b571c1f738428165734d2a.zip
Merge pull request #106 from adityacp/fix_timezone
Fix timezone
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 2a3adbf..db2f9bf 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -16,6 +16,8 @@ from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import Group
from django.forms.models import inlineformset_factory
+from django.utils import timezone
+import pytz
from taggit.models import Tag
from itertools import chain
import json
@@ -464,7 +466,7 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None):
new_answer.error = result.get('error')
new_answer.save()
paper.update_marks('inprogress')
- paper.set_end_time(datetime.now())
+ paper.set_end_time(timezone.now())
if not result.get('success'): # Should only happen for non-mcq questions.
new_answer.answer = user_code
new_answer.save()
@@ -542,7 +544,7 @@ def complete(request, reason=None, attempt_num=None, questionpaper_id=None):
paper = AnswerPaper.objects.get(user=user, question_paper=q_paper,
attempt_number=attempt_num)
paper.update_marks()
- paper.set_end_time(datetime.now())
+ paper.set_end_time(timezone.now())
if paper.percent == 100:
message = "You answered all the questions correctly.\
You have been logged out successfully,\