summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/models.py4
-rw-r--r--yaksh/test_models.py6
2 files changed, 7 insertions, 3 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 6a7b800..46cf603 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1496,7 +1496,9 @@ class AnswerPaper(models.Model):
objects = AnswerPaperManager()
class Meta:
- unique_together = ('user', 'question_paper', 'attempt_number')
+ unique_together = ('user', 'question_paper',
+ 'attempt_number', "course"
+ )
def get_per_question_score(self, question_id):
if question_id not in self.get_questions().values_list('id', flat=True):
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index 9166a3e..5db0f27 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -774,7 +774,8 @@ class AnswerPaperTestCases(unittest.TestCase):
question_paper=self.question_paper,
start_time=self.start_time,
end_time=self.end_time,
- user_ip=self.ip
+ user_ip=self.ip,
+ course=self.course
)
self.attempted_papers = AnswerPaper.objects.filter(
question_paper=self.question_paper,
@@ -1321,7 +1322,8 @@ class AnswerPaperTestCases(unittest.TestCase):
question_paper=self.answerpaper.question_paper,
attempt_number=self.answerpaper.attempt_number,
start_time=self.answerpaper.start_time,
- end_time=self.answerpaper.end_time
+ end_time=self.answerpaper.end_time,
+ course=self.answerpaper.course
)