blob: 7809f1740bb2dcd156155d9a43834da53bc7415d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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))
|