summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authormaheshgudi2017-10-04 18:58:55 +0530
committermaheshgudi2017-10-04 19:09:06 +0530
commitba817cda209787e4bc959aac8d16726a8aea1ed9 (patch)
tree3d691029f3facba9f3793d959304a888d3dcbd45 /yaksh/models.py
parent1e00b0d30c6bef05ef24d9a1b149986276608afd (diff)
downloadonline_test-ba817cda209787e4bc959aac8d16726a8aea1ed9.tar.gz
online_test-ba817cda209787e4bc959aac8d16726a8aea1ed9.tar.bz2
online_test-ba817cda209787e4bc959aac8d16726a8aea1ed9.zip
Update non-code and non-upload answers instead of creating a new one
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index d9e07fd..0d67397 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1284,6 +1284,11 @@ class AnswerPaper(models.Model):
}]
return q_a
+ def get_latest_answer(self,question_id):
+ all_answers = self.answers.filter(question=question_id)
+ if all_answers:
+ return all_answers[0]
+
def get_questions(self):
return self.questions.filter(active=True)