diff options
Diffstat (limited to 'app/books/views.py')
-rw-r--r-- | app/books/views.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/app/books/views.py b/app/books/views.py new file mode 100644 index 0000000..7809f17 --- /dev/null +++ b/app/books/views.py @@ -0,0 +1,32 @@ +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): + obj = get_object_or_404(Book, slug__exact=slug) + return render_to_response('details/book.html', {'object': obj}, context_instance=RequestContext(request)) + +def book_list(request, page): + request.page_url = '/book/%d/' + request.page = int(page) + try: + is_build = request.POST['builder'] + extra_context={ + 'page':page, + 'MEDIA_URL': settings.BAKED_MEDIA_URL + } + except: + extra_context={'page':page} + context = { + 'object_list': Book.objects.order_by('-read_date').select_related(), + 'page': page + } + return render_to_response("archives/books.html", context, context_instance=RequestContext(request)) |