from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.http import Http404 from django.conf import settings # from django.views.generic import ListView from books.models import Book from locations.models import Region, Country from photos.models import Photo def book_detail(request, slug): context = { 'object': get_object_or_404(Book, slug__exact=slug), 'ratings_range' : range(1, 6) } return render_to_response('details/book.html', context, context_instance=RequestContext(request)) def book_list(request, page): request.page_url = '/books/%d/' request.page = int(page) try: is_build = request.POST['builder'] extra_context={ 'page':page, 'MEDIA_URL': settings.BAKED_MEDIA_URL, 'ratings_range': range(1, 6) } except: extra_context={'page':page} context = { 'object_list': Book.objects.order_by('-read_date').select_related(), 'page': page, 'ratings_range' : range(1, 6) } return render_to_response("archives/books.html", context, context_instance=RequestContext(request))