From 2c53d636aa4a3f36586910e1d3ef5276a7efc337 Mon Sep 17 00:00:00 2001 From: mahesh Date: Wed, 7 Feb 2018 18:49:08 +0530 Subject: Add course as a unique constraint --- yaksh/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'yaksh/models.py') 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): -- cgit