def site_name(request):
    from vcboard import config
    return {
        'session': request.session,
        'VCBOARD_NAME': config('general', 
                            'site_name',
                            default='VCBoard'),
    }
Exemplo n.º 2
0
def base_show_thread(request, forum, thread, page, template):
    """
    Does the work that allows users to view a thread
    """
    paginator = Paginator(thread.posts.valid(), config("thread", "posts_per_page", int, 20))
    page_obj = paginator.page(page)

    # TODO: make the view count increment intelligently
    thread.view_count += 1
    thread.save()

    data = {"forum": forum, "thread": thread, "paginator": paginator, "page": page_obj}
    signals.object_shown.send(sender=Thread, instance=thread, request=request)

    return render(request, template, data)
Exemplo n.º 3
0
def show_forum(request, path, page=1, template="vcboard/forum_detail.html"):
    """
    Displays a forum with its subforums and topics, if any
    """
    forum = Forum.objects.with_path(path)
    if not forum:
        raise Http404

    threads_per_page = forum.threads_per_page
    if threads_per_page == 0:
        threads_per_page = config("forum", "threads_per_page", int, 20)
    paginator = Paginator(forum.threads.all(), threads_per_page)
    page_obj = paginator.page(page)

    data = {"forum": forum, "paginator": paginator, "page": page_obj}

    signals.object_shown.send(sender=Forum, instance=forum, request=request)

    return render(request, template, data)