Ejemplo n.º 1
0
def index_view(request):
    """Show new questions with their associated articles. We use
       a paginator here so the user can scroll indefinitely.
    """
    question_set = Question.objects.order_by("-modified")
    article_set = Question.objects.order_by("-modified")
    questions = get_paginated(request, question_set)
    articles = get_paginated(request, article_set)
    context = {"questions": questions, "articles": articles}
    return render(request, "main/index.html", context)
Ejemplo n.º 2
0
def all_tags(request):
    """Show all tags, with recently created first
    """
    tags_set = (Tag.objects.order_by("-modified").annotate(
        count=Count("article_tags")).order_by("count"))
    tags = get_paginated(request, tags_set)
    return render(request, "tags/all.html", {"tags": tags})
Ejemplo n.º 3
0
def all_examples(request):
    """Show all examples, ordered by most recent
    """
    example_set = Example.objects.order_by("-modified")
    examples = get_paginated(request, example_set)
    return render(request, "examples/all.html", {"examples": examples})
Ejemplo n.º 4
0
def all_reviews(request):
    """Show all open reviews, with recently created first
    """
    prs_set = PullRequest.objects.filter(status="open").order_by("-modified")
    prs = get_paginated(request, prs_set)
    return render(request, "reviews/all.html", {"prs": prs})
Ejemplo n.º 5
0
def all_articles(request):
    """Show all articles, with most recently modified first
    """
    article_set = Article.objects.order_by("-modified")
    articles = get_paginated(request, article_set)
    return render(request, "articles/all.html", {"articles": articles})