forums.models module¶
-
class
forums.models.
Forum
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A Forum is a discussion location for a defined set of Users.
A Forum instance can be publicly visible. For publicly invisible forums, as well as for thread creation and posting rights, access is specified flexibly on a per-Group and/or per-User basis via object-level permissions (through the django-guardian required app).
Forums can be related to parent/children via parent [GenericForeignKey] and child_forums [GenericRelation] fields.
Similarly, Posts in a Forum are listed in the posts [GenericRelation] field.
-
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
slug
¶ 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.
-
publicly_visible
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
moderators
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
parent_content_type
¶ 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 aForwardManyToOneDescriptor
instance.
-
parent_object_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
parent
¶ Provide a generic many-to-one relation through the
content_type
andobject_id
fields.This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.
-
child_forums
¶ Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
-
posts
¶ Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
-
motions
¶ Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
-
objects
= <django.db.models.manager.ManagerFromForumQuerySet object>¶
-
property
nr_posts
¶ Recursively counts the number of posts in this Forum.
-
property
latest_post
¶
-
property
posts_all
¶ Return all posts in the hierarchy.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
meeting
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
parent_content_type_id
¶
-
parent_forums
¶ 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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
-
class
forums.models.
Meeting
(*args, **kwargs)[source]¶ Bases:
forums.models.Forum
A Meeting is a Forum but with fixed start and end dates, and with additional descriptor fields (preamble, minutes).
By definition, adding new Posts is allowed up to and including the date specified in
date_until
. The Meeting can however be viewed in perpetuity by users who have viewing rights.-
forum
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
date_from
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
date_until
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
preamble
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
minutes
¶ 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>¶
-
property
future
¶
-
property
ongoing
¶
-
property
past
¶
-
property
context_colors
¶ If meeting is future: primary; ongoing: success; voting: warning; finished: info.
-
exception
DoesNotExist
¶ Bases:
forums.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
forums.models.MultipleObjectsReturned
-
child_forums
¶ Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
-
forum_id
¶
-
get_next_by_date_from
(*, field=<django.db.models.fields.DateField: date_from>, is_next=True, **kwargs)¶
-
get_next_by_date_until
(*, field=<django.db.models.fields.DateField: date_until>, is_next=True, **kwargs)¶
-
get_previous_by_date_from
(*, field=<django.db.models.fields.DateField: date_from>, is_next=False, **kwargs)¶
-
get_previous_by_date_until
(*, field=<django.db.models.fields.DateField: date_until>, is_next=False, **kwargs)¶
-
motions
¶ Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
-
parent
¶ Provide a generic many-to-one relation through the
content_type
andobject_id
fields.This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.
-
posts
¶ Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
-
-
class
forums.models.
Post
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A comment, feedback, question or similar, with a specified parent object.
If the Post is submitted by Admin, Advisory Board members or Fellows, it is marked as not needing vetting before becoming visible. Similarly, for Posts created by organizations.Contacts, no vetting is required. Otherwise, e.g. for Contributors-submitted Posts to a publicly-visible Forum, vetting by Admin is required.
A Post must have a parent object (represented here as a GenericForeignKey). If the parent is a Forum, the Post is interpreted as the head of a new discussion thread. If the parent is a Post, then it is interpreted as part of an ongoing thread.
The text field can contain plain text, Markdown or reStructuredText markup, auto-recognized via the markup app facilities.
-
posted_by
¶ 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 aForwardManyToOneDescriptor
instance.
-
posted_on
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
needs_vetting
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
vetted_by
¶ 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 aForwardManyToOneDescriptor
instance.
-
parent_content_type
¶ 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 aForwardManyToOneDescriptor
instance.
-
parent_object_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
parent
¶ Provide a generic many-to-one relation through the
content_type
andobject_id
fields.This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.
-
followup_posts
¶ Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
-
subject
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
text
¶ 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.ManagerFromPostQuerySet object>¶
-
property
nr_followups
¶
-
property
latest_followup
¶
-
property
latest_followup_in_hierarchy
¶
-
get_anchor_forum_or_meeting
()[source]¶ Climb back the hierarchy up to the original Forum. If no Forum is found, return None.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
get_next_by_posted_on
(*, field=<django.db.models.fields.DateTimeField: posted_on>, is_next=True, **kwargs)¶
-
get_previous_by_posted_on
(*, field=<django.db.models.fields.DateTimeField: posted_on>, 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.
-
motion
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
parent_content_type_id
¶
-
parent_forums
¶ 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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
parent_posts
¶ 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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
posted_by_id
¶
-
vetted_by_id
¶
-
-
class
forums.models.
Motion
(*args, **kwargs)[source]¶ Bases:
forums.models.Post
A Motion is a posting to a Forum or Meeting, on which Forum participants can vote.
-
post
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
eligible_for_voting
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
in_agreement
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
in_doubt
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
in_disagreement
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
in_abstain
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
voting_deadline
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
accepted
¶ 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>¶
-
exception
DoesNotExist
¶ Bases:
forums.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
forums.models.MultipleObjectsReturned
-
followup_posts
¶ Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.comments
is a ReverseGenericManyToOneDescriptor instance.
-
get_next_by_voting_deadline
(*, field=<django.db.models.fields.DateField: voting_deadline>, is_next=True, **kwargs)¶
-
get_previous_by_voting_deadline
(*, field=<django.db.models.fields.DateField: voting_deadline>, is_next=False, **kwargs)¶
-
parent
¶ Provide a generic many-to-one relation through the
content_type
andobject_id
fields.This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.
-
parent_forums
¶ 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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
post_id
¶
-