Forum Forms
inyoka.forum.forms
Forms for the forum.
- copyright:
2007-2024 by the Inyoka Team, see AUTHORS for more details.
- license:
BSD, see LICENSE for more details.
- class inyoka.forum.forms.AddAttachmentForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)
Allows the user to upload new attachments. It provides the following fields:
- attachment
A file field for the uploaded file.
- filename
The target filename. If this is left blank the original filename is used for the server too.
- override
A checkbox for the override flag. If this is true a filename with the same name is overridden (A new revision is created)
- description
The description of the attachment as textarea.
- base_fields = {'attachment': <django.forms.fields.FileField object>, 'comment': <django.forms.fields.CharField object>, 'filename': <django.forms.fields.CharField object>, 'override': <django.forms.fields.BooleanField object>}
- declared_fields = {'attachment': <django.forms.fields.FileField object>, 'comment': <django.forms.fields.CharField object>, 'filename': <django.forms.fields.CharField object>, 'override': <django.forms.fields.BooleanField object>}
- property media
Return all media required to render the widgets on this form.
- use_required_attribute = False
- class inyoka.forum.forms.AddPollForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)
- base_fields = {'duration': <django.forms.fields.IntegerField object>, 'multiple': <django.forms.fields.BooleanField object>, 'options': <inyoka.utils.forms.MultiField object>, 'question': <django.forms.fields.CharField object>}
- declared_fields = {'duration': <django.forms.fields.IntegerField object>, 'multiple': <django.forms.fields.BooleanField object>, 'options': <inyoka.utils.forms.MultiField object>, 'question': <django.forms.fields.CharField object>}
- property media
Return all media required to render the widgets on this form.
- use_required_attribute = False
- class inyoka.forum.forms.EditForumForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)
- class Meta
- fields = ['name', 'slug', 'description', 'parent', 'position', 'newtopic_default_text', 'force_version', 'user_count_posts', 'support_group', 'welcome_title', 'welcome_text']
- _meta = <django.forms.models.ModelFormOptions object>
- base_fields = {'description': <django.forms.fields.CharField object>, 'force_version': <django.forms.fields.BooleanField object>, 'name': <django.forms.fields.CharField object>, 'newtopic_default_text': <django.forms.fields.CharField object>, 'parent': <django.forms.models.ModelChoiceField object>, 'position': <django.forms.fields.IntegerField object>, 'slug': <django.forms.fields.SlugField object>, 'support_group': <django.forms.models.ModelChoiceField object>, 'user_count_posts': <django.forms.fields.BooleanField object>, 'welcome_text': <django.forms.fields.CharField object>, 'welcome_title': <django.forms.fields.CharField object>}
- clean_slug()
- clean_welcome_msg_text()
- clean_welcome_title()
- declared_fields = {}
- property media
Return all media required to render the widgets on this form.
- class inyoka.forum.forms.EditPostForm(is_first_post, needs_spam_check, request, *args, **kwargs)
Allows the user to edit the text of a post. This form takes the additional keyword argument is_first_post. It’s generally used together with AddAttachmentForm.
- base_fields = {'sticky': <django.forms.fields.BooleanField object>, 'text': <inyoka.utils.forms.StrippedCharField object>, 'title': <django.forms.fields.CharField object>, 'ubuntu_distro': <django.forms.fields.ChoiceField object>, 'ubuntu_version': <django.forms.fields.ChoiceField object>}
- clean_text()
- declared_fields = {'sticky': <django.forms.fields.BooleanField object>, 'text': <inyoka.utils.forms.StrippedCharField object>, 'title': <django.forms.fields.CharField object>, 'ubuntu_distro': <django.forms.fields.ChoiceField object>, 'ubuntu_version': <django.forms.fields.ChoiceField object>}
- property media
Return all media required to render the widgets on this form.
- sticky
the user can select, whether the post’s topic should be sticky or not.
- surge_protection_timeout = 90
- class inyoka.forum.forms.ForumField(user, *args, **kwargs)
Custom ChoiceField, where a user can select a forum. By default, it only contains forums the user can view. Furthermore, all forum categories are excluded, too.
Returns the selected forum-id (as integer).
- set_forum_choices(privilege='forum.view_forum')
Generates a hierarchical representation of all forums for a choice field. Only forums with at least privilege for the current user are taken into account.
Optgroups are used to disable categories in the choice field.
- to_python(value)
As the choice field just contains forum-ids, we cast it to int. If it is somehow empty, None will be returned.
- class inyoka.forum.forms.MoveTopicForm(*args, **kwargs)
This form gives the user the possibility to select a new forum for a topic.
- base_fields = {'edit_post': <django.forms.fields.BooleanField object>}
- clean_forum()
- declared_fields = {'edit_post': <django.forms.fields.BooleanField object>}
- property media
Return all media required to render the widgets on this form.
- class inyoka.forum.forms.NewTopicForm(force_version, needs_spam_check, request, *args, **kwargs)
Allows the user to create a new topic. It provides the following fields:
- title
The title of the topic.
- text
The text of the first post inside the topic.
- polls
A list of new polls bound to this topic.
- ubuntu_version
The ubuntu version the user has.
- ubuntu_distro
The ubuntu distribution the user has.
It’s used together with AddAttachmentForm in general.
- base_fields = {'sticky': <django.forms.fields.BooleanField object>, 'text': <inyoka.utils.forms.StrippedCharField object>, 'title': <inyoka.utils.forms.StrippedCharField object>, 'ubuntu_distro': <django.forms.fields.ChoiceField object>, 'ubuntu_version': <django.forms.fields.ChoiceField object>}
- clean_text()
- clean_ubuntu_distro()
- clean_ubuntu_version()
- declared_fields = {'sticky': <django.forms.fields.BooleanField object>, 'text': <inyoka.utils.forms.StrippedCharField object>, 'title': <inyoka.utils.forms.StrippedCharField object>, 'ubuntu_distro': <django.forms.fields.ChoiceField object>, 'ubuntu_version': <django.forms.fields.ChoiceField object>}
- property media
Return all media required to render the widgets on this form.
- surge_protection_timeout = 90
- class inyoka.forum.forms.ReportListForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)
This form lets the moderator select a bunch of topics for removing the reported flag.
- base_fields = {'selected': <django.forms.fields.MultipleChoiceField object>}
- declared_fields = {'selected': <django.forms.fields.MultipleChoiceField object>}
- property media
Return all media required to render the widgets on this form.
- class inyoka.forum.forms.ReportTopicForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)
Allows the user to report the moderators a topic. It’s only field is a text field where the user can write why he thinks that the moderators should have a look at this topic.
- base_fields = {'text': <django.forms.fields.CharField object>}
- declared_fields = {'text': <django.forms.fields.CharField object>}
- property media
Return all media required to render the widgets on this form.
- class inyoka.forum.forms.SplitTopicForm(*args, **kwargs)
This form used on the split topic page gives the user the choice whether the posts should be moved into an existing or a new topic.
- base_fields = {'action': <django.forms.fields.ChoiceField object>, 'edit_post': <django.forms.fields.BooleanField object>, 'new_title': <django.forms.fields.CharField object>, 'topic_to_move': <inyoka.utils.forms.TopicField object>, 'ubuntu_distro': <django.forms.fields.ChoiceField object>, 'ubuntu_version': <django.forms.fields.ChoiceField object>}
- clean()
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- clean_forum()
- declared_fields = {'action': <django.forms.fields.ChoiceField object>, 'edit_post': <django.forms.fields.BooleanField object>, 'new_title': <django.forms.fields.CharField object>, 'topic_to_move': <inyoka.utils.forms.TopicField object>, 'ubuntu_distro': <django.forms.fields.ChoiceField object>, 'ubuntu_version': <django.forms.fields.ChoiceField object>}
- property media
Return all media required to render the widgets on this form.
- ubuntu_version
version info. defaults to the values set in the old topic.
- use_required_attribute = False