Exemplo n.º 1
0
Arquivo: views.py Projeto: Brant/bscom
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))
Exemplo n.º 2
0
Arquivo: views.py Projeto: Brant/bscom
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))
Exemplo n.º 3
0
Arquivo: views.py Projeto: Brant/bscom
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))
Exemplo n.º 4
0
Arquivo: views.py Projeto: Brant/bscom
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))