summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authoradityacp2020-03-03 16:19:29 +0530
committeradityacp2020-03-03 16:19:29 +0530
commitf85fbae3c76595a8f2039a60c0e7051d39dfe643 (patch)
treee342a216e5196e079e3bcc3bd0148b617ac29bdc /yaksh
parent718f475f279a0600b7157a8c82d3198ee87b7a32 (diff)
downloadonline_test-f85fbae3c76595a8f2039a60c0e7051d39dfe643.tar.gz
online_test-f85fbae3c76595a8f2039a60c0e7051d39dfe643.tar.bz2
online_test-f85fbae3c76595a8f2039a60c0e7051d39dfe643.zip
Show specific fields for answerpaper in admin
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/admin.py8
-rw-r--r--yaksh/models.py2
2 files changed, 9 insertions, 1 deletions
diff --git a/yaksh/admin.py b/yaksh/admin.py
index 495b48d..9c36a98 100644
--- a/yaksh/admin.py
+++ b/yaksh/admin.py
@@ -9,6 +9,14 @@ from django.contrib import admin
class AnswerPaperAdmin(admin.ModelAdmin):
search_fields = ['user__first_name', 'user__last_name', 'user__username',
"question_paper__quiz__description", "user_ip"]
+ list_filter = ['course__is_trial']
+ readonly_fields = ["course", "question_paper"]
+
+ def get_form(self, request, obj=None, **kwargs):
+ self.exclude = ("answers", "questions_unanswered",
+ "questions_answered", "questions")
+ form = super(AnswerPaperAdmin, self).get_form(request, obj, **kwargs)
+ return form
class ProfileAdmin(admin.ModelAdmin):
diff --git a/yaksh/models.py b/yaksh/models.py
index 2ebfa38..9aa3e0b 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1603,7 +1603,7 @@ class Answer(models.Model):
self.marks = marks
def __str__(self):
- return self.answer
+ return "Answer for question {0}".format(self.question.summary)
###############################################################################