diff options
author | prathamesh | 2014-06-24 17:42:08 +0530 |
---|---|---|
committer | prathamesh | 2014-06-24 17:42:08 +0530 |
commit | b1ecd46e3924cae0201bdf4bc16f34c7ae16b081 (patch) | |
tree | d08d6640c27a5e90cbdf9ca325c86149b7da6dbf /testapp/exam/forms.py | |
parent | fa402a2c9a34a1728f863ddcbab62fa8e030099e (diff) | |
download | online_test-b1ecd46e3924cae0201bdf4bc16f34c7ae16b081.tar.gz online_test-b1ecd46e3924cae0201bdf4bc16f34c7ae16b081.tar.bz2 online_test-b1ecd46e3924cae0201bdf4bc16f34c7ae16b081.zip |
modification in models
Added shuffle option in the question paper.
Added language field, passing criteria and prerequisite quiz in quiz.
Added pass/fail result and percentage field in the answerpaper.
Diffstat (limited to 'testapp/exam/forms.py')
-rw-r--r-- | testapp/exam/forms.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/testapp/exam/forms.py b/testapp/exam/forms.py index 7c66944..1f1a2af 100644 --- a/testapp/exam/forms.py +++ b/testapp/exam/forms.py @@ -27,6 +27,9 @@ QUESTION_TYPES = ( ("mcq", "Multiple Choice"), ("code", "Code"), ) +QUIZZES =[('select', 'Select a prerequisite quiz')] +quizzes = Quiz.objects.all() +QUIZZES = QUIZZES+[(quiz.id, quiz) for quiz in quizzes] UNAME_CHARS = letters + "._" + digits PWD_CHARS = letters + punctuation + digits @@ -132,18 +135,31 @@ class QuizForm(forms.Form): active = forms.BooleanField(required=False) description = forms.CharField(max_length=256, widget=forms.Textarea\ (attrs={'cols': 20, 'rows': 1})) + pass_criteria = forms.FloatField(initial=40, + help_text='Will be taken as percentage') + language = forms.CharField(widget=forms.Select(choices=LANGUAGES)) + prerequisite = forms.CharField(required=False, + widget=forms.Select(choices=QUIZZES)) def save(self): start_date = self.cleaned_data["start_date"] duration = self.cleaned_data["duration"] active = self.cleaned_data['active'] description = self.cleaned_data["description"] + pass_criteria = self.cleaned_data["pass_criteria"] + language = self.cleaned_data["language"] + prerequisite = self.cleaned_data["prerequisite"] + new_quiz = Quiz() new_quiz.start_date = start_date new_quiz.duration = duration new_quiz.active = active new_quiz.description = description + new_quiz.pass_criteria = pass_criteria + new_quiz.language = language + if isinstance(prerequisite, int): + new_quiz.prerequisite_id = prerequisite new_quiz.save() @@ -191,3 +207,10 @@ class QuestionForm(forms.Form): new_question.active = active new_question.snippet = snippet new_question.save() + + + class RandomQuestionForm(forms.Form): + question_type = forms.CharField(max_length=8, widget=forms.Select\ + (choices=QUESTION_TYPES)) + shuffle_questions = forms.BooleanField(required=False) + |