summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authoradityacp2016-06-06 13:51:17 +0530
committeradityacp2016-06-06 13:51:17 +0530
commitbff7f1c916db44e3aec09020affe347e0a1846a6 (patch)
tree6b7ff6435b9a1507d4bab18d452d0db558b0981e /yaksh/views.py
parent660a8b4f8b21a1e5836536a9db755fcf840ecd63 (diff)
downloadonline_test-bff7f1c916db44e3aec09020affe347e0a1846a6.tar.gz
online_test-bff7f1c916db44e3aec09020affe347e0a1846a6.tar.bz2
online_test-bff7f1c916db44e3aec09020affe347e0a1846a6.zip
changed naive datetime to aware datetime in models.py, views.py, tests.py
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,\