summaryrefslogtreecommitdiff
path: root/testapp/exam/forms.py
diff options
context:
space:
mode:
authorankitjavalkar2015-03-18 12:16:20 +0530
committerankitjavalkar2015-04-26 19:46:00 +0530
commit28ba37e907553aeac3841e221853683b9171f0db (patch)
tree9926315f93ac82fb21ae1f98450cfa031da8f996 /testapp/exam/forms.py
parenta88e59fa419d7ab31aa430e7424ff0a25169713f (diff)
downloadonline_test-28ba37e907553aeac3841e221853683b9171f0db.tar.gz
online_test-28ba37e907553aeac3841e221853683b9171f0db.tar.bz2
online_test-28ba37e907553aeac3841e221853683b9171f0db.zip
Changes to Question model, Views, Add-Question UI
- ref_code_path is now part of Question model - MCQ/MCC answers checked using solution field in question model - Formset should reload even after errors - add_question page chould display solution field only in MCQ/MCC
Diffstat (limited to 'testapp/exam/forms.py')
-rw-r--r--testapp/exam/forms.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/testapp/exam/forms.py b/testapp/exam/forms.py
index e3cef40..93584a6 100644
--- a/testapp/exam/forms.py
+++ b/testapp/exam/forms.py
@@ -187,8 +187,8 @@ class QuestionForm(forms.ModelForm):
description = forms.CharField(widget=forms.Textarea\
(attrs={'cols': 40, 'rows': 1}))
points = forms.FloatField()
- # test = forms.CharField(widget=forms.Textarea\
- # (attrs={'cols': 40, 'rows': 1}), required=False)
+ solution = forms.CharField(widget=forms.Textarea\
+ (attrs={'cols': 40, 'rows': 1}), required=False)
options = forms.CharField(widget=forms.Textarea\
(attrs={'cols': 40, 'rows': 1}), required=False)
language = forms.CharField(max_length=20, widget=forms.Select\
@@ -199,17 +199,18 @@ class QuestionForm(forms.ModelForm):
tags = TagField(widget=TagAutocomplete(), required=False)
snippet = forms.CharField(widget=forms.Textarea\
(attrs={'cols': 40, 'rows': 1}), required=False)
+ ref_code_path = forms.CharField(widget=forms.Textarea\
+ (attrs={'cols': 40, 'rows': 1}), required=False)
def save(self, commit=True):
- summary = self.cleaned_data["summary"]
- description = self.cleaned_data["description"]
- points = self.cleaned_data['points']
- # test = self.cleaned_data["test"]
- options = self.cleaned_data['options']
- language = self.cleaned_data['language']
- type = self.cleaned_data["type"]
- active = self.cleaned_data["active"]
- snippet = self.cleaned_data["snippet"]
+ summary = self.cleaned_data.get("summary")
+ description = self.cleaned_data.get("description")
+ points = self.cleaned_data.get("points")
+ options = self.cleaned_data.get("options")
+ language = self.cleaned_data.get("language")
+ type = self.cleaned_data.get("type")
+ active = self.cleaned_data.get("active")
+ snippet = self.cleaned_data.get("snippet")
new_question = Question()
new_question.summary = summary