summaryrefslogtreecommitdiff
path: root/testapp/exam/models.py
diff options
context:
space:
mode:
authorhardythe12012-04-14 06:28:44 +0530
committerhardythe12012-04-14 06:28:44 +0530
commit5d7ab20a710e2374a3345b07ed62154456dbd2c8 (patch)
treec553204df559a8c71e7b462a18b48f548d7fe193 /testapp/exam/models.py
parentc0fcc1181e209192f6d11f2ca521e55e33a4ead7 (diff)
downloadonline_test-5d7ab20a710e2374a3345b07ed62154456dbd2c8.tar.gz
online_test-5d7ab20a710e2374a3345b07ed62154456dbd2c8.tar.bz2
online_test-5d7ab20a710e2374a3345b07ed62154456dbd2c8.zip
model changes as per requirnment
Diffstat (limited to 'testapp/exam/models.py')
-rw-r--r--testapp/exam/models.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/testapp/exam/models.py b/testapp/exam/models.py
index ad3dad8..dd0c033 100644
--- a/testapp/exam/models.py
+++ b/testapp/exam/models.py
@@ -2,7 +2,7 @@ import datetime
from django.db import models
from django.contrib.auth.models import User
from taggit_autocomplete_modified.managers import TaggableManagerAutocomplete as TaggableManager
-
+from django.http import HttpResponse
################################################################################
class Profile(models.Model):
"""Profile for a user to store roll number and other details."""
@@ -120,7 +120,10 @@ class AnswerPaper(models.Model):
# The user's profile, we store a reference to make it easier to access the
# data.
profile = models.ForeignKey(Profile)
-
+
+ # All questions that remains to attempt to perticular Student
+ questions = models.CharField(max_length=128)
+
# The Quiz to which this question paper is attached to.
question_paper = models.ForeignKey(QuestionPaper)
@@ -157,7 +160,7 @@ class AnswerPaper(models.Model):
def completed_question(self, question_id):
"""Removes the question from the list of questions and returns
- the next."""
+the next."""
qa = self.questions_answered
if len(qa) > 0:
self.questions_answered = '|'.join([qa, str(question_id)])
@@ -193,7 +196,7 @@ class AnswerPaper(models.Model):
except AttributeError:
# total_seconds is new in Python 2.7. :(
secs = dt.seconds + dt.days*24*3600
- total = self.quiz.duration*60.0
+ total = self.question_paper.quiz.duration*60.0
remain = max(total - secs, 0)
return int(remain)