diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-08-22 09:49:53 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-08-22 09:49:53 -0400 |
commit | 260305720861c09a37373bf00689c9ea4e51f1cc (patch) | |
tree | 06d2c690431217e490ad99bce281feb8c38d144f /askbot/forms.py | |
parent | 7e5c66a4bd37720d24ff86b87ac5d81b89340d39 (diff) | |
parent | a485a301207f401dc9a8d838bcb3442fdbe8bccd (diff) | |
download | askbot-260305720861c09a37373bf00689c9ea4e51f1cc.tar.gz askbot-260305720861c09a37373bf00689c9ea4e51f1cc.tar.bz2 askbot-260305720861c09a37373bf00689c9ea4e51f1cc.zip |
completed merge of user-groups with tag-editor, not tested yet
Diffstat (limited to 'askbot/forms.py')
-rw-r--r-- | askbot/forms.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/askbot/forms.py b/askbot/forms.py index 7030643a..7baec106 100644 --- a/askbot/forms.py +++ b/askbot/forms.py @@ -357,7 +357,8 @@ class TagNamesField(forms.CharField): def __init__(self, *args, **kwargs): super(TagNamesField, self).__init__(*args, **kwargs) - self.required = askbot_settings.TAGS_ARE_REQUIRED + self.required = kwargs.get('required', + askbot_settings.TAGS_ARE_REQUIRED) self.widget = forms.TextInput( attrs={'size': 50, 'autocomplete': 'off'} ) @@ -899,6 +900,7 @@ class AskWidgetForm(forms.Form, FormWithHideableFields): '''Simple form with just the title to ask a question''' title = TitleField() + text = EditorField() ask_anonymously = forms.BooleanField( label=_('ask anonymously'), help_text=_( @@ -908,12 +910,18 @@ class AskWidgetForm(forms.Form, FormWithHideableFields): required=False, ) - def __init__(self, *args, **kwargs): + def __init__(self, include_text=True, *args, **kwargs): super(AskWidgetForm, self).__init__(*args, **kwargs) #hide ask_anonymously field - if askbot_settings.ALLOW_ASK_ANONYMOUSLY is False: + if not askbot_settings.ALLOW_ASK_ANONYMOUSLY: self.hide_field('ask_anonymously') + if not include_text: + self.hide_field('text') + self.fields['text'].required=False + else: + self.fields['text'].min_length = askbot_settings.MIN_QUESTION_BODY_LENGTH + class AskByEmailForm(forms.Form): """:class:`~askbot.forms.AskByEmailForm` validates question data, where question was posted |