def clean(self): cleaned_data = super(QuestionForm, self).clean() unislug = unislugify(cleaned_data.get('subject')) if Question.objects.filter(entity=cleaned_data['entity'], unislug=unislug).count(): raise ValidationError(_("Question already exists.")) return cleaned_data
def save(self, **kwargs): # make a unicode slug from the subject self.unislug = unislugify(self.subject) return super(Question, self).save(**kwargs)
def clean(self): cleaned_data = super(QuestionForm, self).clean() unislug = unislugify(cleaned_data.get('subject')) return cleaned_data