Returns the url of the forum whose topics will be marked read.
1262
def get_forum_url(self):
        
        return reverse('forum:forum', kwargs={'slug': self.forum.slug, 'pk': self.forum.pk})
699257
def get_queryset(self):
        
        # Determines the forums that can be accessed by the current user
        forums = self.request.forum_permission_handler.get_readable_forums(
            Forum.objects.all(), self.request.user,
        )

        # Returns the posts submitted by the considered user.
        return (
            Post.objects
            .select_related('topic', 'topic__forum', 'poster')
            .prefetch_related('poster__forum_profile')
            .filter(poster=self.poster, topic__forum__in=forums)
            .order_by('-created')
        )
939920
def get_page_and_url(session, url):
    
    reply = get_reply(session, url)
    return reply.text, reply.url
936573
def post_url(self):
        
        topic = self.topic
        topic_page = topic.post_set.filter(id__lt=self.id).count() / get_paginate_by() + 1
        return "{0}page{1}/#post-{2}".format(topic.get_short_url(), topic_page, self.id)
785442
def get_urlpatterns(self):
        
        return [
            path(
                _('mark/forums/'),
                self.mark_forums_read_view.as_view(),
                name='mark_all_forums_read',
            ),
            path(
                _('mark/forums/<int:pk>/'),
                self.mark_forums_read_view.as_view(),
                name='mark_subforums_read',
            ),
            path(
                _('mark/forum/<int:pk>/topics/'),
                self.mark_topics_read_view.as_view(),
                name='mark_topics_read',
            ),
            path(
                _('unread-topics/'),
                self.unread_topics_view.as_view(),
                name='unread_topics',
            ),
        ]
180364
public static function get_forum_discussions_paginated_returns() {
        return new external_single_structure(
            array(
                'discussions' => new external_multiple_structure(
                        new external_single_structure(
                            array(
                                'id' => new external_value(PARAM_INT, 'Post id'),
                                'name' => new external_value(PARAM_TEXT, 'Discussion name'),
                                'groupid' => new external_value(PARAM_INT, 'Group id'),
                                'timemodified' => new external_value(PARAM_INT, 'Time modified'),
                                'usermodified' => new external_value(PARAM_INT, 'The id of the user who last modified'),
                                'timestart' => new external_value(PARAM_INT, 'Time discussion can start'),
                                'timeend' => new external_value(PARAM_INT, 'Time discussion ends'),
                                'discussion' => new external_value(PARAM_INT, 'Discussion id'),
                                'parent' => new external_value(PARAM_INT, 'Parent id'),
                                'userid' => new external_value(PARAM_INT, 'User who started the discussion id'),
                                'created' => new external_value(PARAM_INT, 'Creation time'),
                                'modified' => new external_value(PARAM_INT, 'Time modified'),
                                'mailed' => new external_value(PARAM_INT, 'Mailed?'),
                                'subject' => new external_value(PARAM_TEXT, 'The post subject'),
                                'message' => new external_value(PARAM_RAW, 'The post message'),
                                'messageformat' => new external_format_value('message'),
                                'messagetrust' => new external_value(PARAM_INT, 'Can we trust?'),
                                'messageinlinefiles' => new external_files('post message inline files', VALUE_OPTIONAL),
                                'attachment' => new external_value(PARAM_RAW, 'Has attachments?'),
                                'attachments' => new external_files('attachments', VALUE_OPTIONAL),
                                'totalscore' => new external_value(PARAM_INT, 'The post message total score'),
                                'mailnow' => new external_value(PARAM_INT, 'Mail now?'),
                                'userfullname' => new external_value(PARAM_TEXT, 'Post author full name'),
                                'usermodifiedfullname' => new external_value(PARAM_TEXT, 'Post modifier full name'),
                                'userpictureurl' => new external_value(PARAM_URL, 'Post author picture.'),
                                'usermodifiedpictureurl' => new external_value(PARAM_URL, 'Post modifier picture.'),
                                'numreplies' => new external_value(PARAM_INT, 'The number of replies in the discussion'),
                                'numunread' => new external_value(PARAM_INT, 'The number of unread discussions.'),
                                'pinned' => new external_value(PARAM_BOOL, 'Is the discussion pinned'),
                                'locked' => new external_value(PARAM_BOOL, 'Is the discussion locked'),
                                'canreply' => new external_value(PARAM_BOOL, 'Can the user reply to the discussion'),
                                'canlock' => new external_value(PARAM_BOOL, 'Can the user lock the discussion'),
                            ), 'post'
                        )
                    ),
                'warnings' => new external_warnings()
            )
        );
    }
487038
def get_queryset(self):
        
        forums = self.request.forum_permission_handler.get_readable_forums(
            Forum.objects.all(), self.request.user,
        )
        topics = Topic.objects.filter(forum__in=forums)
        topics_pk = map(lambda t: t.pk, track_handler.get_unread_topics(topics, self.request.user))
        return Topic.approved_objects.filter(pk__in=topics_pk).order_by('-last_post_on')
183844
def _fast_permalink(self):
        """"""
        if hasattr(self, 'link_id'):  # from /r or /u comments page
            sid = self.link_id.split('_')[1]
        else:  # from user's /message page
            sid = self.context.split('/')[4]
        return urljoin(self.reddit_session.config['comments'], '{0}/_/{1}'
                       .format(sid, self.id))
67216
def get_paginated_position(self):
        
        # If Post list is not paginated
        if not settings.FORUM_THREAD_DETAIL_PAGINATE:
            return 0
        
        count = Post.objects.filter(thread=self.thread_id, created__lt=self.created).count() + 1
        
        return int(math.ceil(count / float(settings.FORUM_THREAD_DETAIL_PAGINATE)))
451928
def from_forums(cls, forums):
        
        root_level = None
        current_path = []
        nodes = []

        # Ensures forums last posts and related poster relations are "followed" for better
        # performance (only if we're considering a queryset).
        forums = (
            forums.select_related('last_post', 'last_post__poster')
            if isinstance(forums, QuerySet) else forums
        )

        for forum in forums:
            level = forum.level

            # Set the root level to the top node level at the first iteration.
            if root_level is None:
                root_level = level

            # Initializes a visibility forum node associated with current forum instance.
            vcontent_node = ForumVisibilityContentNode(forum)

            # Computes a relative level associated to the node.
            relative_level = level - root_level
            vcontent_node.relative_level = relative_level

            # All children nodes will be stored in an array attached to the current node.
            vcontent_node.children = []

            # Removes the forum that are not in the current branch.
            while len(current_path) > relative_level:
                current_path.pop(-1)

            if level != root_level:
                # Update the parent of the current forum.
                parent_node = current_path[-1]
                vcontent_node.parent = parent_node
                parent_node.children.append(vcontent_node)

            # Sets visible flag if applicable. The visible flag is used to determine whether a forum
            # can be seen in a forum list or not. A forum can be seen if one of the following
            # statements is true:
            #
            # * the forum is a direct child of the starting forum for the considered level
            # * the forum have a parent which is a category and this category is a direct child of
            #   the starting forum
            # * the forum have its 'display_sub_forum_list' option set to True and have a parent
            #   which is another forum. The latter is a direct child of the starting forum
            # * the forum have its 'display_sub_forum_list' option set to True and have a parent
            #   which is another forum. The later have a parent which is a category and this
            #   category is a direct child of the starting forum
            #
            # If forums at the root level don't have parents, the visible forums are those that can
            # be seen from the root of the forums tree.
            vcontent_node.visible = (
                (relative_level == 0) or
                (forum.display_sub_forum_list and relative_level == 1) or
                (forum.is_category and relative_level == 1) or
                (
                    relative_level == 2 and
                    vcontent_node.parent.parent.obj.is_category and
                    vcontent_node.parent.obj.is_forum
                )
            )

            # Add the current forum to the end of the current branch and inserts the node inside the
            # final node dictionary.
            current_path.append(vcontent_node)
            nodes.append(vcontent_node)

        tree = cls(nodes=nodes)
        for node in tree.nodes:
            node.tree = tree

        return tree
136939
def get_urls(self):
        
        urls = super().get_urls()
        forum_admin_urls = [
            url(
                r'^(?P<forum_id>[0-9]+)/move-forum/(?P<direction>up|down)/$',
                self.admin_site.admin_view(self.moveforum_view),
                name='forum_forum_move',
            ),
            url(
                r'^edit-global-permissions/$',
                self.admin_site.admin_view(self.editpermissions_index_view),
                name='forum_forum_editpermission_index',
            ),
            url(
                r'^edit-global-permissions/user/(?P<user_id>[0-9]+)/$',
                self.admin_site.admin_view(self.editpermissions_user_view),
                name='forum_forum_editpermission_user',
            ),
            url(
                r'^edit-global-permissions/user/anonymous/$',
                self.admin_site.admin_view(self.editpermissions_anonymous_user_view),
                name='forum_forum_editpermission_anonymous_user',
            ),
            url(
                r'^edit-global-permissions/group/(?P<group_id>[0-9]+)/$',
                self.admin_site.admin_view(self.editpermissions_group_view),
                name='forum_forum_editpermission_group',
            ),
            url(
                r'^(?P<forum_id>[0-9]+)/edit-permissions/$',
                self.admin_site.admin_view(self.editpermissions_index_view),
                name='forum_forum_editpermission_index',
            ),
            url(
                r'^(?P<forum_id>[0-9]+)/edit-permissions/user/(?P<user_id>[0-9]+)/$',
                self.admin_site.admin_view(self.editpermissions_user_view),
                name='forum_forum_editpermission_user',
            ),
            url(
                r'^(?P<forum_id>[0-9]+)/edit-permissions/user/anonymous/$',
                self.admin_site.admin_view(self.editpermissions_anonymous_user_view),
                name='forum_forum_editpermission_anonymous_user',
            ),
            url(
                r'^(?P<forum_id>[0-9]+)/edit-permissions/group/(?P<group_id>[0-9]+)/$',
                self.admin_site.admin_view(self.editpermissions_group_view),
                name='forum_forum_editpermission_group',
            ),
        ]
        return forum_admin_urls + urls
1090668
def recurseforumcontents(parser, token):
    
    bits = token.contents.split()
    forums_contents_var = template.Variable(bits[1])

    template_nodes = parser.parse(('endrecurseforumcontents',))
    parser.delete_first_token()

    return RecurseTreeForumVisibilityContentNode(template_nodes, forums_contents_var)
653030
def get_unread_forums(self, user):
        
        return self.get_unread_forums_from_list(
            user, self.perm_handler.get_readable_forums(Forum.objects.all(), user))
26284
def topic(self):
        
        if self.api and self.topic_id:
            return self.api._get_topic(self.topic_id)
979236
def get_success_url(self):
        
        messages.success(self.request, _('Your vote has been cast.'))
        return reverse(
            'forum_conversation:topic',
            kwargs={
                'forum_slug': self.object.topic.forum.slug,
                'forum_pk': self.object.topic.forum.pk,
                'slug': self.object.topic.slug,
                'pk': self.object.topic.pk,
            },
        )
329856
def get_urlpatterns(self):
        
        return [
            path('', self.index_view.as_view(), name='index'),
            path(
                _('forum/<str:slug>-<int:pk>/'),
                self.forum_view.as_view(),
                name='forum',
            ),
        ]
417593
def find_forum(category_name, forum_name, options = {})
      category = self.find_category(category_name, options)
      if category
        self.forums.detect {|f| f['category_id'] == category['id'] && f['name'] == forum_name }
      end
    end