summaryrefslogtreecommitdiff
path: root/testapp/exam/forms.py
diff options
context:
space:
mode:
authorankitjavalkar2015-07-23 16:32:13 +0530
committerankitjavalkar2015-08-05 12:00:54 +0530
commitdbab99bc13b8483c24706e47a9a0926508e3c332 (patch)
tree27fc89e79ce8ce8332fc7288993f6c7ff2537bb3 /testapp/exam/forms.py
parent214d8696fafee4e38c6bf039315aac37e4cd2e2b (diff)
downloadonline_test-dbab99bc13b8483c24706e47a9a0926508e3c332.tar.gz
online_test-dbab99bc13b8483c24706e47a9a0926508e3c332.tar.bz2
online_test-dbab99bc13b8483c24706e47a9a0926508e3c332.zip
Add filters: Minor fixes
Diffstat (limited to 'testapp/exam/forms.py')
-rw-r--r--testapp/exam/forms.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/testapp/exam/forms.py b/testapp/exam/forms.py
index 1c61816..8739bfb 100644
--- a/testapp/exam/forms.py
+++ b/testapp/exam/forms.py
@@ -242,15 +242,19 @@ class RandomQuestionForm(forms.Form):
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]
+ def __init__(self, *args, **kwargs):
+ super(QuestionFilterForm, self).__init__(*args, **kwargs)
+ questions = Question.objects.all()
+ points_list = questions.values_list('points', flat=True).distinct()
+ points_options = [('select', 'Select Marks')]
+ points_options.extend([(point, point) for point in points_list])
+ self.fields['marks'] = forms.FloatField(widget=forms.Select\
+ (choices=points_options))
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,\