From f85fbae3c76595a8f2039a60c0e7051d39dfe643 Mon Sep 17 00:00:00 2001 From: adityacp Date: Tue, 3 Mar 2020 16:19:29 +0530 Subject: Show specific fields for answerpaper in admin --- yaksh/admin.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'yaksh/admin.py') 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): -- cgit