Пример #1
0
def category(request, category_slug):
    """
    All entries belonging to a given category
    """
    category = get_object_or_404(Category, slug=category_slug)
    entries = Entry.objects.filter(date__lte=datetime.utcnow().replace(tzinfo=utc), category=category, draft=False)
    entries = make_paginator(request, entries)

    response_data = {"entries": entries, "category": category}

    return render_to_response("blog/category.html", response_data, context_instance=RequestContext(request))
Пример #2
0
def index(request):
    """
    Blog Index

    Must be published, according to its date
    """

    entries = Entry.objects.prefetch_related('category').filter(date__lte=datetime.utcnow().replace(tzinfo=utc), draft=False)
    entries = make_paginator(request, entries)

    response_data = {
        "entries": entries
    }

    return render_to_response("blog/index.html", response_data, RequestContext(request))
Пример #3
0
def index(request):
    """
    Blog Index

    Must be published, according to its date
    """

    entries = Entry.objects.prefetch_related('category').filter(
        date__lte=datetime.utcnow().replace(tzinfo=utc), draft=False)
    entries = make_paginator(request, entries)

    response_data = {"entries": entries}

    return render_to_response("blog/index.html", response_data,
                              RequestContext(request))
Пример #4
0
def category(request, category_slug):
    """
    All entries belonging to a given category
    """
    category = get_object_or_404(Category, slug=category_slug)
    entries = Entry.objects.filter(
        date__lte=datetime.utcnow().replace(tzinfo=utc),
        category=category,
        draft=False)
    entries = make_paginator(request, entries)

    response_data = {"entries": entries, "category": category}

    return render_to_response("blog/category.html",
                              response_data,
                              context_instance=RequestContext(request))