:py:mod:`oioioi.forum.models` ============================= .. py:module:: oioioi.forum.models Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.forum.models.Forum oioioi.forum.models.Category oioioi.forum.models.Thread oioioi.forum.models.Post oioioi.forum.models.PostReaction oioioi.forum.models.Ban Functions ~~~~~~~~~ .. autoapisummary:: oioioi.forum.models._set_as_new_last_post oioioi.forum.models._update_last_post oioioi.forum.models._remove_reports_if_approved Attributes ~~~~~~~~~~ .. autoapisummary:: oioioi.forum.models.post_reaction_types .. py:class:: Forum(*args, **kwargs) Bases: :py:obj:`django.db.models.Model` Forum is connected with contest .. py:class:: Meta Bases: :py:obj:`object` .. py:attribute:: verbose_name .. py:attribute:: verbose_name_plural .. py:attribute:: contest .. py:attribute:: visible .. py:attribute:: lock_date .. py:attribute:: unlock_date .. py:method:: __str__() Return str(self). .. py:method:: is_autolocked(now=None) Returns true if forum is locked .. py:method:: is_autounlocked(now=None) Returns true if forum was unlocked .. py:method:: is_locked(now=None) Returns true if forum is locked and not unlocked .. py:class:: Category(*args, **kwargs) Bases: :py:obj:`django.db.models.Model` Category model .. py:class:: Meta Bases: :py:obj:`object` .. py:attribute:: verbose_name .. py:attribute:: verbose_name_plural .. py:attribute:: unique_together :annotation: = ['forum', 'order'] .. py:attribute:: ordering :annotation: = ['order'] .. py:attribute:: forum .. py:attribute:: name .. py:attribute:: order .. py:attribute:: reactions_enabled .. py:attribute:: short_description .. py:attribute:: short_description .. py:attribute:: short_description .. py:method:: __str__() Return str(self). .. py:method:: count_threads() .. py:method:: count_posts() .. py:method:: count_reported() .. py:method:: get_admin_url() .. py:method:: save(**kwargs) 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. .. py:class:: Thread(*args, **kwargs) Bases: :py:obj:`django.db.models.Model` Thread model - topic in a category .. py:class:: Meta Bases: :py:obj:`object` .. py:attribute:: ordering :annotation: = ['-last_post__id'] .. py:attribute:: verbose_name .. py:attribute:: verbose_name_plural .. py:attribute:: category .. py:attribute:: name .. py:attribute:: last_post .. py:attribute:: short_description .. py:attribute:: short_description .. py:method:: __str__() Return str(self). .. py:method:: count_posts() .. py:method:: count_reported() .. py:method:: get_admin_url() .. py:class:: Post(*args, **kwargs) Bases: :py:obj:`django.db.models.Model` Post - the basic part of the forum .. py:class:: PostsWithReactionsSummaryManager Bases: :py:obj:`django.db.models.Manager` .. py:method:: get_queryset() .. py:class:: Meta Bases: :py:obj:`object` .. py:attribute:: index_together :annotation: = [['thread', 'add_date']] .. py:attribute:: ordering :annotation: = ['add_date'] .. py:attribute:: verbose_name .. py:attribute:: verbose_name_plural .. py:property:: edited .. py:attribute:: thread .. py:attribute:: content .. py:attribute:: add_date .. py:attribute:: last_edit_date .. py:attribute:: author .. py:attribute:: reported .. py:attribute:: report_reason .. py:attribute:: approved .. py:attribute:: hidden .. py:attribute:: reported_by .. py:attribute:: objects .. py:method:: __str__() Return str(self). .. py:method:: get_admin_url() .. py:method:: get_in_thread_url() .. py:method:: can_be_removed() .. py:method:: is_author_banned() .. py:method:: is_reporter_banned() .. py:data:: post_reaction_types .. py:class:: PostReaction(*args, **kwargs) Bases: :py:obj:`django.db.models.Model` PostReaction - represents a reaction to a post on the forum. .. py:attribute:: post .. py:attribute:: author .. py:attribute:: type_of_reaction .. py:class:: Ban(*args, **kwargs) Bases: :py:obj:`django.db.models.Model` Ban model - represents a ban on a forum. Banned person should not be allowed any 'write' interaction with forum. This includes reporting posts. .. py:attribute:: user .. py:attribute:: forum .. py:attribute:: admin .. py:attribute:: created_at .. py:attribute:: reason .. py:method:: is_banned(forum, user) :staticmethod: .. py:method:: __str__() Return str(self). .. py:function:: _set_as_new_last_post(sender, instance, created, **kwargs) .. py:function:: _update_last_post(sender, instance, **kwargs) .. py:function:: _remove_reports_if_approved(sender, instance, **kwargs)