コード例 #1
0
ファイル: views.py プロジェクト: yoktys/bbs_django
def thread_list(request, pk):
    """
    Listing of threads in a forum.
    """
    threads = Thread.objects.filter(forum=pk).order_by("-created")
    threads = make_paginator(request, threads, 20)
    return render_to_response("forum/forum.html", add_csrf(request, threads=threads, pk=pk))
コード例 #2
0
ファイル: views.py プロジェクト: yoktys/bbs_django
    def get(self, request, post_type, pk):
        # url パスを見てフォームの着地点を決める。
        if post_type == "new_thread":
            form_action = reverse('create_thread_view', args=[pk])
            title = "Start New Topic"
            subject = ''
        elif post_type == "reply":
            form_action = reverse('create_post_reply_view', args=[pk])
            title = "Reply"
            subject = "Re: " + Thread.objects.get(pk=pk).title

        context = {
            'title': title,
            'subject': subject,
            'action': form_action,
        }
        return render_to_response('forum/new_posting.html', add_csrf(self.request, **context))