Forum conversation

The forum_conversation application handles all the conversations that can happen in forums. It provides some of the main features of a forum application: posting messages, writing answers, voting in polls, ...

Abstract models

class machina.apps.forum_conversation.abstract_models.AbstractPost(*args, **kwargs)

Bases: machina.models.abstract_models.DatedModel

Represents a forum post. A forum post is always linked to a topic.

is_alone

Returns True if the post is the only single post of the topic.

is_topic_head

Returns True if the post is the first post of the topic.

is_topic_tail

Returns True if the post is the last post of the topic.

position

Returns an integer corresponding to the position of the post in the topic.

class machina.apps.forum_conversation.abstract_models.AbstractTopic(*args, **kwargs)

Bases: machina.models.abstract_models.DatedModel

Represents a forum topic.

has_subscriber(user)

Returns True if the given user is a subscriber of this topic.

is_announce

Returns True if the topic is an announce.

is_locked

Returns True if the topic is locked.

is_sticky

Returns True if the topic is a sticky topic.

is_topic

Returns True if the topic is a default topic.

update_trackers()

Updates the posts count, the update date and the link toward the last post associated with the current topic.

Views

class machina.apps.forum_conversation.views.BasePostFormView(**kwargs)

Bases: django.views.generic.edit.FormView

A base view for handling post forms.

form_invalid(post_form, attachment_formset, **kwargs)

Called if one of the forms is invalid. Re-renders the context data with the data-filled forms and errors.

form_valid(post_form, attachment_formset, **kwargs)

Called if all forms are valid. Creates a Post instance along with associated attachments if required and then redirects to a success page.

get_attachment_formset(formset_class)

Returns an instance of the attachment formset to be used in the view.

get_attachment_formset_class()

Returns the attachment formset class to use for instantiating the attachment formset.

get_attachment_formset_kwargs()

Returns the keyword arguments for instantiating the attachment formset.

get_attachments_cache_key(request)

Returns the key used to store attachment files states into the file based cache.

get_forum()

Returns the considered forum.

get_post()

Returns the considered post if applicable.

get_post_form(form_class)

Returns an instance of the post form to be used in the view.

get_post_form_class()

Returns the post form class to use for instantiating the form.

get_post_form_kwargs()

Returns the keyword arguments for instantiating the post form.

get_topic()

Returns the considered topic if applicable.

init_attachment_cache()

Initializes the attachment cache for the current view.

class machina.apps.forum_conversation.views.BaseTopicFormView(**kwargs)

Bases: machina.apps.forum_conversation.views.BasePostFormView

A base view for handling topic forms.

get_poll_option_formset(formset_class)

Returns an instance of the poll option formset to be used in the view.

get_poll_option_formset_class()

Returns the poll option formset class to use for instantiating the poll option formset.

get_poll_option_formset_kwargs()

Returns the keyword arguments for instantiating the poll option formset.

class machina.apps.forum_conversation.views.PostCreateView(**kwargs)

Bases: machina.apps.forum_permission.viewmixins.PermissionRequiredMixin, machina.apps.forum_conversation.views.PostFormView

Allows users to create forum posts.

model

alias of Post

class machina.apps.forum_conversation.views.PostDeleteView(**kwargs)

Bases: machina.apps.forum_permission.viewmixins.PermissionRequiredMixin, django.views.generic.edit.DeleteView

Allows users to delete forum topics.

model

alias of Post

class machina.apps.forum_conversation.views.PostFormView(**kwargs)

Bases: django.views.generic.detail.SingleObjectMixin, machina.apps.forum_conversation.views.BasePostFormView

A base view for manipulating post forms.

class machina.apps.forum_conversation.views.PostUpdateView(**kwargs)

Bases: machina.apps.forum_permission.viewmixins.PermissionRequiredMixin, machina.apps.forum_conversation.views.PostFormView

Allows users to update forum topics.

model

alias of Post

class machina.apps.forum_conversation.views.TopicCreateView(**kwargs)

Bases: machina.apps.forum_permission.viewmixins.PermissionRequiredMixin, machina.apps.forum_conversation.views.TopicFormView

Allows users to create forum topics.

model

alias of Topic

class machina.apps.forum_conversation.views.TopicFormView(**kwargs)

Bases: django.views.generic.detail.SingleObjectMixin, machina.apps.forum_conversation.views.BaseTopicFormView

A base view for manipulating topic forms.

class machina.apps.forum_conversation.views.TopicUpdateView(**kwargs)

Bases: machina.apps.forum_permission.viewmixins.PermissionRequiredMixin, machina.apps.forum_conversation.views.TopicFormView

Allows users to update forum topics.

get_post()

Returns the considered post if applicable.

model

alias of Topic

class machina.apps.forum_conversation.views.TopicView(**kwargs)

Bases: machina.apps.forum_permission.viewmixins.PermissionRequiredMixin, django.views.generic.list.ListView

Displays a forum topic.

get_topic()

Returns the topic to consider.