summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 2a06cc8..e2b9952 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1711,12 +1711,17 @@ class Answer(models.Model):
# Whether skipped or not.
skipped = models.BooleanField(default=False)
+ comment = models.TextField(null=True, blank=True)
+
def set_marks(self, marks):
if marks > self.question.points:
self.marks = self.question.points
else:
self.marks = marks
+ def set_comment(self, comments):
+ self.comment = comments
+
def __str__(self):
return "Answer for question {0}".format(self.question.summary)
@@ -2360,6 +2365,11 @@ class AnswerPaper(models.Model):
self.end_time = datetime
self.save()
+ def get_answer_comment(self, question_id):
+ answer = self.answers.filter(question_id=question_id).last()
+ if answer:
+ return answer.comment
+
def get_question_answers(self):
"""
Return a dictionary with keys as questions and a list of the