forums.views module

class forums.views.ForumCreateView(**kwargs)[source]

Bases: scipost.mixins.PermissionsMixin, django.views.generic.edit.CreateView

permission_required = 'forums.add_forum'
model

alias of forums.models.Forum

form_class

alias of forums.forms.ForumForm

template_name = 'forums/forum_form.html'
success_url = '/forums/'
get_initial()[source]

Return the initial data to use for forms on this view.

class forums.views.MeetingCreateView(**kwargs)[source]

Bases: forums.views.ForumCreateView

model

alias of forums.models.Meeting

form_class

alias of forums.forms.MeetingForm

class forums.views.ForumUpdateView(**kwargs)[source]

Bases: guardian.mixins.PermissionRequiredMixin, django.views.generic.edit.UpdateView

permission_required = 'forums.update_forum'
template_name = 'forums/forum_form.html'
get_object(queryset=None)[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

get_form(form_class=None)[source]

Return an instance of the form to be used in this view.

class forums.views.ForumDeleteView(**kwargs)[source]

Bases: guardian.mixins.PermissionRequiredMixin, django.views.generic.edit.DeleteView

permission_required = 'forums.delete_forum'
model

alias of forums.models.Forum

success_url = '/forums/'
delete(request, *args, **kwargs)[source]

A Forum can only be deleted if it does not have any descendants. Upon deletion, all object-level permissions associated to the Forum are explicitly removed, to avoid orphaned permissions.

class forums.views.ForumDetailView(**kwargs)[source]

Bases: guardian.mixins.PermissionRequiredMixin, django.views.generic.detail.DetailView

permission_required = 'forums.can_view_forum'
model

alias of forums.models.Forum

template_name = 'forums/forum_detail.html'
get_context_data(*args, **kwargs)[source]

Insert the single object into the context dict.

class forums.views.ForumPermissionsView(**kwargs)[source]

Bases: guardian.mixins.PermissionRequiredMixin, django.views.generic.edit.UpdateView

permission_required = 'forums.can_change_forum'
model

alias of forums.models.Forum

form_class

alias of forums.forms.ForumGroupPermissionsForm

template_name = 'forums/forum_permissions.html'
get_context_data(*args, **kwargs)[source]

Insert the form into the context dict.

get_initial(*args, **kwargs)[source]

Return the initial data to use for forms on this view.

form_valid(form)[source]

If the form is valid, save the associated model.

class forums.views.ForumListView(**kwargs)[source]

Bases: django.contrib.auth.mixins.LoginRequiredMixin, django.views.generic.list.ListView

model

alias of forums.models.Forum

template_name = 'forum_list.html'
get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

class forums.views.PostCreateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.UserPassesTestMixin, django.views.generic.edit.CreateView

First step of a two-step Post creation process. This view, upon successful POST, redirects to the PostConfirmCreateView confirmation view.

To transfer form data from this view to the next (confirmation) one, two session variables are used, post_subject and post_text.

model

alias of forums.models.Post

form_class

alias of forums.forms.PostForm

test_func()[source]
get_initial(*args, **kwargs)[source]

Return the initial data to use for forms on this view.

form_valid(form)[source]

Save the form data to session variables only, redirect to confirmation view.

class forums.views.MotionCreateView(**kwargs)[source]

Bases: forums.views.PostCreateView

Specialization of PostCreateView to Motion-class objects.

By default, all users who can create a Post on the associated Forum are given voting rights.

model

alias of forums.models.Motion

form_class

alias of forums.forms.MotionForm

template_name = 'forums/motion_form.html'
get_initial(*args, **kwargs)[source]

Return the initial data to use for forms on this view.

form_valid(form)[source]

Save the form data to session variables only, redirect to confirmation view.

class forums.views.PostConfirmCreateView(**kwargs)[source]

Bases: forums.views.PostCreateView

Second (confirmation) step of Post creation process.

Upon successful POST, the Post object is saved and the two session variables post_subject and post_text are deleted.

form_class

alias of forums.forms.PostForm

template_name = 'forums/post_confirm_create.html'
get_form(form_class=None)[source]

Return an instance of the form to be used in this view.

get_initial(*args, **kwargs)[source]

Return the initial data to use for forms on this view.

form_valid(form)[source]

After deleting the session variables used for the confirmation step, simply perform the form_valid calls of form_valid from ancestor classes ModelFormMixin and FormMixin, due to the fact that the form_valid method in the PostCreateView superclass was overriden to a redirect.

class forums.views.MotionConfirmCreateView(**kwargs)[source]

Bases: forums.views.PostConfirmCreateView

Specialization of PostConfirmCreateView to Motion-class objects.

form_class

alias of forums.forms.MotionForm

template_name = 'forums/motion_confirm_create.html'
get_initial(*args, **kwargs)[source]

Return the initial data to use for forms on this view.

form_valid(form)[source]

After deleting the session variables used for the confirmation step, simply perform the form_valid calls of form_valid from ancestor classes ModelFormMixin and FormMixin, due to the fact that the form_valid method in the PostCreateView superclass was overriden to a redirect.

forums.views.motion_vote(request, slug, motion_id, vote)[source]