diff options
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r-- | yaksh/forms.py | 7 |
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 |