+
+class QuestionEditorField(EditorField):
+ def __init__(self, *args, **kwargs):
+ super(QuestionEditorField, self).__init__(*args, **kwargs)
+ self.required = not bool(settings.FORM_EMPTY_QUESTION_BODY)
+
+
+ def clean(self, value):
+ if self.required and (len(value) < settings.FORM_MIN_QUESTION_BODY):
+ raise forms.ValidationError(_('question content must be at least %s characters') % settings.FORM_MIN_QUESTION_BODY)
+
+ return value
+
+class AnswerEditorField(EditorField):
+ def __init__(self, *args, **kwargs):
+ super(AnswerEditorField, self).__init__(*args, **kwargs)
+ self.required = True
+