summaryrefslogtreecommitdiff
path: root/yaksh/forms.py
diff options
context:
space:
mode:
authorankitjavalkar2017-05-31 19:44:43 +0530
committerankitjavalkar2017-05-31 19:44:43 +0530
commitc277c1f742d8d984fc7ab066cd3ac513e83f0d89 (patch)
tree679487712389306f3ea7acb9abd0f80a118c0d1b /yaksh/forms.py
parent689e777cf21e30b33fd9fccbd6c2cd5dc4d935ea (diff)
downloadonline_test-c277c1f742d8d984fc7ab066cd3ac513e83f0d89.tar.gz
online_test-c277c1f742d8d984fc7ab066cd3ac513e83f0d89.tar.bz2
online_test-c277c1f742d8d984fc7ab066cd3ac513e83f0d89.zip
Fix conditional logic to pass test
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r--yaksh/forms.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py
index 14a3db0..2740497 100644
--- a/yaksh/forms.py
+++ b/yaksh/forms.py
@@ -246,9 +246,10 @@ class QuizForm(forms.ModelForm):
def clean_prerequisite(self):
prereq = self.cleaned_data['prerequisite']
- if prereq and prereq.prerequisite.id == self.instance.id:
- raise forms.ValidationError("Please set another prerequisite quiz")
- return None
+ if prereq and prereq.prerequisite:
+ if prereq.prerequisite.id == self.instance.id:
+ raise forms.ValidationError("Please set another prerequisite quiz")
+ return prereq
class Meta:
model = Quiz