forums package

Contents

forums package#

Submodules#

forums.admin module#

Generated by utils/cgit/cgit_util_generate_admin_file on 2022-01-24 14:26:19.559531

class forums.admin.Comment1Admin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model Comment1

autocomplete_fields = ['post']#
property media#
search_fields = ['author']#
class forums.admin.Comment2Admin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model Comment2

autocomplete_fields = ['post', 'comment1']#
property media#
search_fields = ['author']#
class forums.admin.ForumAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model Forum

property media#
search_fields = ['title']#
class forums.admin.ForumFollowAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model ForumFollow

autocomplete_fields = ['user', 'forum']#
property media#
class forums.admin.LikeComment1Admin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model LikeComment1

autocomplete_fields = ['comment1']#
property media#
class forums.admin.LikeComment2Admin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model LikeComment2

autocomplete_fields = ['comment2']#
property media#
class forums.admin.LikePostAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model LikePost

autocomplete_fields = ['post']#
property media#
class forums.admin.PostAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model Post

autocomplete_fields = ['forum']#
property media#
search_fields = ['author']#

forums.apps module#

class forums.apps.ForumsConfig(app_name, app_module)[source]#

Bases: AppConfig

name = 'forums'#

forums.filters module#

class forums.filters.PostFilter(data=None, queryset=None, *, request=None, prefix=None)[source]#

Bases: FilterSet

class Meta[source]#

Bases: object

fields = ['title', 'author', 'forum']#
model#

alias of Post

base_filters = {'author': <django_filters.filters.ModelChoiceFilter object>, 'forum': <django_filters.filters.ModelChoiceFilter object>, 'title': <django_filters.filters.CharFilter object>}#
declared_filters = {'title': <django_filters.filters.CharFilter object>}#

forums.forms module#

class forums.forms.Comment2Form(*args, **kwargs)[source]#

Bases: ModelForm

class Meta[source]#

Bases: object

fields = ('text', 'post', 'comment1')#
model#

alias of Comment2

base_fields = {'comment1': <django.forms.models.ModelChoiceField object>, 'post': <django.forms.models.ModelChoiceField object>, 'text': <django.forms.fields.CharField object>}#
declared_fields = {}#
property media#

Return all media required to render the widgets on this form.

class forums.forms.CommentForm(*args, **kwargs)[source]#

Bases: ModelForm

class Meta[source]#

Bases: object

fields = ('text', 'post')#
model#

alias of Comment1

base_fields = {'post': <django.forms.models.ModelChoiceField object>, 'text': <django.forms.fields.CharField object>}#
declared_fields = {}#
property media#

Return all media required to render the widgets on this form.

class forums.forms.ForumForm(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)[source]#

Bases: ModelForm

class Meta[source]#

Bases: object

fields = ['title', 'description', 'forum_type']#
model#

alias of Forum

base_fields = {'description': <django.forms.fields.CharField object>, 'forum_type': <django.forms.fields.TypedChoiceField object>, 'title': <django.forms.fields.CharField object>}#
declared_fields = {}#
property media#

Return all media required to render the widgets on this form.

class forums.forms.PostForm(*args, **kwargs)[source]#

Bases: ModelForm

class Meta[source]#

Bases: object

fields = ('forum', 'title', 'text')#
model#

alias of Post

base_fields = {'forum': <django.forms.models.ModelChoiceField object>, 'get_notified_of_replies': <django.forms.fields.ChoiceField object>, 'text': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}#
declared_fields = {'get_notified_of_replies': <django.forms.fields.ChoiceField object>, 'text': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}#
property media#

Return all media required to render the widgets on this form.

forums.models module#

Models for Forums

class forums.models.AbstractForum(*args, **kwargs)[source]#

Bases: Model

Lots of things have the same attributes so use an Abstract Class

class Meta[source]#

Bases: object

We are abstract

abstract = False#
ordering = ['-created_date']#
author#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

author_id#
created_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=True, **kwargs)#
get_previous_by_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=False, **kwargs)#
last_change_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_changed_by#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class forums.models.AbstractLike(*args, **kwargs)[source]#

Bases: Model

Abstract for likes

class Meta[source]#

Bases: object

We are abstract

abstract = False#
liker#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

liker_id#
class forums.models.Comment1(*args, **kwargs)[source]#

Bases: AbstractForum

First level comments

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

author#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

author_id#
comment1_count#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

comment2_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

created_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=True, **kwargs)#
get_previous_by_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_change_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_changed_by#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

likecomment1_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>#
post#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

post_id#
text#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class forums.models.Comment2(*args, **kwargs)[source]#

Bases: AbstractForum

Second level comments

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

author#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

author_id#
comment1#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

comment1_id#
created_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=True, **kwargs)#
get_previous_by_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_change_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_changed_by#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

likecomment2_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>#
post#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

post_id#
text#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class forums.models.Forum(*args, **kwargs)[source]#

Bases: Model

Forum is a list of valid places to create a Post

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

bg_colour#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fg_colour#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

forum_type#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

forumfollow_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_forum_type_display(*, field=<django.db.models.fields.CharField: forum_type>)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
post_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

title#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class forums.models.ForumFollow(*args, **kwargs)[source]#

Bases: Model

List of Forums that a user is subscribed to

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

forum#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

forum_id#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
user#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_id#
class forums.models.LikeComment1(*args, **kwargs)[source]#

Bases: AbstractLike

Like for a comment1

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

comment1#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

comment1_id#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

liker#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

liker_id#
objects = <django.db.models.manager.Manager object>#
class forums.models.LikeComment2(*args, **kwargs)[source]#

Bases: AbstractLike

Like for a comment2

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

comment2#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

comment2_id#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

liker#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

liker_id#
objects = <django.db.models.manager.Manager object>#
class forums.models.LikePost(*args, **kwargs)[source]#

Bases: AbstractLike

Like for a post

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

liker#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

liker_id#
objects = <django.db.models.manager.Manager object>#
post#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

post_id#
class forums.models.Post(*args, **kwargs)[source]#

Bases: AbstractForum

A Post is the highest level thing in Forums

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

author#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

author_id#
comment1_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

comment2_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

comment_count#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

forum#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

forum_id#
get_next_by_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=True, **kwargs)#
get_previous_by_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_change_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_changed_by#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

likepost_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>#
save(*args, **kwargs)[source]#

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

text#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

title#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

forums.tests module#

forums.urls module#

forums.views module#

Views for Forums

forums.views.block_user(request, user_id, forum_id)[source]#

stop a user from being able to post to a forum

forums.views.comment1_edit(request, comment_id)[source]#
forums.views.comment2_edit(request, comment_id)[source]#
forums.views.comment_edit_common(request, comment, comment_type)[source]#

common code for editing c1 and c2

forums.views.follow_forum_ajax(request, forum_id)[source]#

Function to follow a forum over ajax

Parameters:
  • request (HTTPRequest) – standard request object

  • pk (int) – Primary key of the forum to follow

Returns:

HttpResponse

forums.views.follow_post_ajax(request, post_id)[source]#

Function to follow a post over ajax

Parameters:
  • request (HTTPRequest) – standard request object

  • post_id (int) – Primary key of the post to follow

Returns:

HttpResponse

forums.views.forum_create(request)[source]#

view to create a new forum

Args: request(HTTPRequest): standard request object

Returns:

HttpResponse

forums.views.forum_delete_ajax(request, forum_id)[source]#

Function to delete a forum

Parameters:
  • request (HTTPRequest) – standard request object

  • forum_id (int) – Primary key of the forum

Returns:

HttpResponse

forums.views.forum_edit(request, forum_id)[source]#

View to allow an admin to edit a forums settings

forums.views.forum_list(request)[source]#

View to show a list of all forums

Parameters:

request (HTTPRequest) – standard request object

Returns:

HTTPResponse

forums.views.forums_status_summary()[source]#

Used by utils status to check on the health of forums

forums.views.get_forum_statistics()[source]#

return stats on forums. Called by utils statistics

forums.views.like_comment1(request, pk)[source]#

Function to like a comment1 over ajax

Parameters:
  • request (HTTPRequest) – standard request object

  • pk (int) – Primary key of the comment1 to like

Returns:

HttpResponse

forums.views.like_comment2(request, pk)[source]#

Function to like a comment2 over ajax

Parameters:
  • request (HTTPRequest) – standard request object

  • pk (int) – Primary key of the comment2 to like

Returns:

HttpResponse

forums.views.like_post(request, pk)[source]#

Function to like a post over ajax

Parameters:
  • request (HTTPRequest) – standard request object

  • pk (int) – Primary key of the post to like

Returns:

HttpResponse

forums.views.notify_moderators_of_abuse(post, c1, c2, user, author, reason)[source]#

Let moderators know about a complaint

forums.views.post_detail(request, pk)[source]#

Main view for existing post.

Shows post and existing comments and allows the user to coment at either level (Comment1 or Comment2).

Parameters:
  • request (HTTPRequest) – standard request object

  • pk (int) – primary key of post

Returns:

HTTPResponse

forums.views.post_edit(request, post_id)[source]#

Edit a post in a forum.

This can be done by the user who created it or a moderator

forums.views.post_list_single_forum(request, forum_id)[source]#

shows posts for a single forum

Parameters:
  • request (HTTPRequest) – standard user request

  • forum_id (int) – forum to view

Returns:

page with list of posts

Return type:

page(HTTPResponse)

forums.views.post_new(request, forum_id=None)[source]#

Create a new post in a forum

forums.views.report_abuse(request)[source]#

Ajax call to report a post or comment that someone doesn’t like

forums.views.unblock_user(request, user_id, forum_id)[source]#

remove block on a user so they can post to a forum

forums.views.unfollow_forum_ajax(request, forum_id)[source]#

Function to unfollow a forum over ajax

Parameters:
  • request (HTTPRequest) – standard request object

  • pk (int) – Primary key of the forum to unfollow

Returns:

HttpResponse

forums.views.unfollow_post_ajax(request, post_id)[source]#

Function to unfollow a post over ajax

Parameters:
  • request (HTTPRequest) – standard request object

  • post_id (int) – Primary key of the post to unfollow

Returns:

HttpResponse

Module contents#