def section(request, section_slug, page): """ Gets 20 threads from current section with OP post and last 5 posts in each thread. """ s = get_object_or_404(Section, slug=section_slug) t = get_page_or_404(Paginator(s.threads(), s.ONPAGE), page) return render(request, "section_page.html", add_sidebar({ "threads": t, "section": s, "form": PostForm() }))
def search(request, section_slug, page): section = get_object_or_404(Section, slug=section_slug) is_op_post = request.GET.get("is_op_post") or False posts = Post.objects.filter(is_op_post=is_op_post, thread__section=section, message__contains=request.GET["q"] ).order_by("-date") if not posts.count(): return render(request, "client_error.html", add_sidebar({ "details": _("Nothing found") })) p = get_page_or_404(Paginator(posts, section.ONPAGE), page) return render(request, "search_results.html", add_sidebar({"posts": p, "section": section}))
def section(request, section_slug, page): s = get_object_or_404(Section, slug=section_slug) p = get_page_or_404(Paginator(s.op_posts(), s.ONPAGE), page) return render(request, "pda/section.html", {"section": s, "posts": p})
def section(request, section_slug, page): s = get_object_or_404(Section, slug=section_slug) t = get_page_or_404(Paginator(s.threads(), s.ONPAGE), page) return render(request, "mobile/section.html", {"section": s, "threads": t})