summaryrefslogtreecommitdiff
path: root/testapp/exam/forms.py
diff options
context:
space:
mode:
authorankitjavalkar2015-07-21 18:02:56 +0530
committerankitjavalkar2015-08-05 12:00:54 +0530
commit214d8696fafee4e38c6bf039315aac37e4cd2e2b (patch)
treef7bc823ab005a9791f020c0eeb7a0a1f828b28fe /testapp/exam/forms.py
parent0225aad1492600ed53504b0986fd13da24c28ae9 (diff)
downloadonline_test-214d8696fafee4e38c6bf039315aac37e4cd2e2b.tar.gz
online_test-214d8696fafee4e38c6bf039315aac37e4cd2e2b.tar.bz2
online_test-214d8696fafee4e38c6bf039315aac37e4cd2e2b.zip
Add filters to question display
Diffstat (limited to 'testapp/exam/forms.py')
-rw-r--r--testapp/exam/forms.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/testapp/exam/forms.py b/testapp/exam/forms.py
index b7625be..1c61816 100644
--- a/testapp/exam/forms.py
+++ b/testapp/exam/forms.py
@@ -240,5 +240,18 @@ class RandomQuestionForm(forms.Form):
(choices=(('select', 'Select Marks'),)))
shuffle_questions = forms.BooleanField(required=False)
+
+class QuestionFilterForm(forms.Form):
+ questions = Question.objects.all()
+ points_list = questions.values_list('points', flat=True).distinct()
+ points_options = [(i, i) for i in points_list]
+
+ language = forms.CharField(max_length=8, widget=forms.Select\
+ (choices=languages))
+ question_type = forms.CharField(max_length=8, widget=forms.Select\
+ (choices=question_types))
+ marks = forms.FloatField(widget=forms.Select(choices=points_options))
+
+
TestCaseFormSet = inlineformset_factory(Question, TestCase,\
can_order=False, can_delete=False, extra=1)