Esempio n. 1
0
def category(request, forum):
    allow_browse_forum(request.user, forum)
    if forum.level == 1:
        return dj_redirect(forum.get_absolute_url())
    forums = get_forums_list(request.user, forum)

    return render(request, 'misago/forums/category.html', {
        'category': forum,
        'forums': forums,
        'path': get_forum_path(forum),
    })
Esempio n. 2
0
def redirect(request, forum):
    if forum.pk not in request.session.get('forum_redirects', []):
        request.session.setdefault('forum_redirects', []).append(forum.pk)
        forum.redirects = F('redirects') + 1
        forum.save(update_fields=['redirects'])
    return dj_redirect(forum.redirect_url)