Forum tracking¶
The forum_tracking
application allows to determine which forums or topics have been read by a
given user. It provides mechanisms allowing users to mark forums or topics as read and to browse
unread forums or topics.
Abstract models¶
Forum tracking abstract models¶
This module defines abstract models provided by the forum_tracking
application.
-
class
machina.apps.forum_tracking.abstract_models.
AbstractForumReadTrack
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
Represents a track which records which forums have been read by a given user.
-
class
machina.apps.forum_tracking.abstract_models.
AbstractTopicReadTrack
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
Represents a track which records which topics have been read by a given user.
Handler¶
Forum tracking handler¶
This module defines a TrackingHandler
abstraction that allows to identify unread forums and
topics.
-
class
machina.apps.forum_tracking.handler.
TrackingHandler
(request=None)¶ Bases:
object
Provides utility methods to compute unread forums and topics.
The TrackingHandler allows to filter list of forums and list of topics in order to get only the forums which contain unread topics or the unread topics.
-
get_unread_forums
(user)¶ Returns the list of unread forums for the given user.
-
get_unread_forums_from_list
(user, forums)¶ Returns the list of unread forums for the given user from a given list of forums.
-
get_unread_topics
(topics, user)¶ Returns a list of unread topics for the given user from a given set of topics.
-
mark_forums_read
(forums, user)¶ Marks a list of forums as read.
-
mark_topic_read
(topic, user)¶ Marks a topic as read.
-
Views¶
Forum tracking views¶
This module defines views provided by the forum_tracking
application.
-
class
machina.apps.forum_tracking.views.
MarkForumsReadView
(**kwargs)¶ Bases:
django.contrib.auth.mixins.LoginRequiredMixin
,django.views.generic.base.TemplateView
Marks a set of forums as read.
-
get
(request, pk=None)¶ Handles GET requests.
-
get_context_data
(**kwargs)¶ Returns the context data to provide to the template.
-
get_top_level_forum_url
()¶ Returns the parent forum from which forums are marked as read.
-
mark_as_read
(request, pk)¶ Marks the considered forums as read.
-
post
(request, pk=None)¶ Handles POST requests.
-
-
class
machina.apps.forum_tracking.views.
MarkTopicsReadView
(**kwargs)¶ Bases:
django.contrib.auth.mixins.LoginRequiredMixin
,machina.apps.forum_permission.viewmixins.PermissionRequiredMixin
,django.views.generic.detail.SingleObjectTemplateResponseMixin
,django.views.generic.detail.BaseDetailView
Marks a set of topics as read.
-
get
(request, pk)¶ Handles GET requests.
-
get_context_data
(**kwargs)¶ Returns the context data to provide to the template.
-
get_controlled_object
()¶ Return the considered forum in order to allow permission checks.
-
get_forum_url
()¶ Returns the url of the forum whose topics will be marked read.
-
mark_topics_read
(request, pk)¶ Marks forum topics as read.
-
model
¶ alias of
machina.core.db.models.Forum
-
post
(request, pk)¶ Handles POST requests.
-