Ejemplo n.º 1
0
def page(request):
    """
    books = Book.objects.all().order_by('a_title')
    paginator = Paginator(books, 2)
    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1

    # If page request (9999) is out of range, deliver last page of results.
    try:
        books = paginator.page(page)
    except (EmptyPage, InvalidPage):
        books = paginator.page(paginator.num_pages)
    """
    all_books = Book.objects.all()
    books, q = get_catalog(request,'html')
    return render_to_response('index.html', {'books': books, 'q':q, 'total_books':len(all_books)})
Ejemplo n.º 2
0
def catalogs(request):
    return HttpResponse(get_catalog(request), mimetype='application/atom+xml')