X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/0f2d00f9d7d5d28149707f66c719b28edfe51aed..3ff018b6b9cc5c0b36054456a671389a481f72a2:/forum/forms.py diff --git a/forum/forms.py b/forum/forms.py index 93a4d15..70466b5 100644 --- a/forum/forms.py +++ b/forum/forms.py @@ -23,8 +23,8 @@ class TitleField(forms.CharField): self.initial = '' def clean(self, value): - if len(value) < 10: - raise forms.ValidationError(_('title must be > 10 characters')) + if len(value) < settings.FORM_MIN_QUESTION_TITLE: + raise forms.ValidationError(_('title must be must be at least %s characters' % settings.FORM_MIN_QUESTION_TITLE)) return value @@ -38,8 +38,8 @@ class EditorField(forms.CharField): self.initial = '' def clean(self, value): - if len(value) < 10: - raise forms.ValidationError(_('question content must be > 10 characters')) + 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 @@ -101,18 +101,6 @@ class SummaryField(forms.CharField): self.label = _('update summary:') self.help_text = _('enter a brief summary of your revision (e.g. fixed spelling, grammar, improved style, this field is optional)') -class ModerateUserForm(forms.ModelForm): - is_approved = forms.BooleanField(label=_("Automatically accept user's contributions for the email updates"), - required=False) - - def clean_is_approved(self): - if 'is_approved' not in self.cleaned_data: - self.cleaned_data['is_approved'] = False - return self.cleaned_data['is_approved'] - - class Meta: - model = User - fields = ('is_approved',) class FeedbackForm(forms.Form): name = forms.CharField(label=_('Your name:'), required=False)