Exemple #1
0
def category_detail(request, category):
    if category is not None:
        article_list = category.article_set.get_recent()
        title = category.name
        graphic_source = category.graphic_source
    else:
        article_list = Article.objects.get_recent()

        # Temporary - until I found a better way of storing this
        title = _("Archives")
        archives_image = "/media/graphics/archives.jpg"
        archives_description = _("All articles")
        graphic_source = "http://www.flickr.com/photos/glynlowe/8494249993/"

        category = {"graphic": {"url": archives_image}, "description": archives_description}

    articles = make_paginator(article_list, request)

    context = {"category": category, "articles": articles, "title": title, "graphic_source": graphic_source}

    return render(request, "category/detail.html", context)
Exemple #2
0
def author_detail(request, slug):
    author = get_object_or_404(Author, slug=slug)
    articles = make_paginator(author.article_set.get_recent(), request)
    context = {"author": author, "articles": articles, "title": author.name, "graphic_source": author.graphic_source}

    return render(request, "author/detail.html", context)