From e41eda9e5ca27742a6430d3abdd6bebcb4704938 Mon Sep 17 00:00:00 2001 From: qw3rty Date: Thu, 29 Apr 2010 18:25:26 +0000 Subject: [PATCH 1/1] OSQA-141: allows admin to allow there users to add a question with an empty body. I would like to ask if this is necessary. couldn't an admin just set the min length of a question to 0? git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@98 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/forms.py | 2 +- forum/settings/form.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/forum/forms.py b/forum/forms.py index 77430ef..35c6083 100644 --- a/forum/forms.py +++ b/forum/forms.py @@ -38,7 +38,7 @@ class EditorField(forms.CharField): self.initial = '' def clean(self, value): - if len(value) < settings.FORM_MIN_QUESTION_BODY: + if len(value) < settings.FORM_MIN_QUESTION_BODY and not settings.FORM_EMPTEY_QUESTION_BODY: raise forms.ValidationError(_('question content must be must be at least %s characters' % settings.FORM_MIN_QUESTION_BODY)) return value diff --git a/forum/settings/form.py b/forum/settings/form.py index 0375b02..5cb1aee 100644 --- a/forum/settings/form.py +++ b/forum/settings/form.py @@ -23,6 +23,11 @@ help_text = _("The minimum number of characters a user must enter into the conte # label = _("Maximum number of characters for a question."), # help_text = _("The maximum number of characters a user can enter into the description field to submit a question."))) +FORM_EMPTEY_QUESTION_BODY = Setting('FORM_EMPTY_QUESTION_BODY', False, FORUM_SET, dict( +label = _("Empty question content"), +help_text = _("If a question's content can be empty."), +required=False)) + """ settings for comments """ -- 2.39.5