Lagt til html-visning av kategorier og en oversikt over hyller.

This commit is contained in:
2011-03-06 18:01:15 +00:00
parent acb9bd6501
commit 79c73b2502
6 changed files with 72 additions and 6 deletions

View File

@@ -32,8 +32,8 @@ def BookView(request,book_identifier):
return render_to_response('book/view.html', {'book' : book, 'people' : people, 'shelves' : shelves, 'contributors' : contributors})
def BookRedirect(request,book_identifier):
ident=get_object_or_404(Id,id=book_identifier)
return HttpResponseRedirect('/book/'+ident.book.isbn)
ident=get_object_or_404(Id,id=book_identifier)
return HttpResponseRedirect('/book/'+ident.book.isbn)
def PersonView(request,person_identifier):
global relations
@@ -51,11 +51,22 @@ def PersonView(request,person_identifier):
contributed[relation][1].append(book)
return render_to_response('person/view.html', {'title' : 'Worblehat: person '+person.first_name+' '+person.last_name, 'person' : person, 'books' : books, 'contributed' : contributed })
def MapIndex(request):
return render_to_response('map/index.html', {'shelves': Placement.get_all_shelves()})
def MapView(request,shelf_identifier):
if shelf_identifier not in Placement.get_all_shelves():
raise Http404()
shelf_list = Placement.shelf_as_list_row_then_col(shelf_identifier)
return render_to_response('map/view.html', {'shelf': shelf_list})
return render_to_response('map/view.html', {'shelf_name': shelf_identifier, 'shelf': shelf_list})
def CategoryIndex(request):
return render_to_response('category/index.html', {'categories': Category.objects.all()})
def CategoryView(request,category_identifier):
category = get_object_or_404(Category,id=category_identifier)
book_list = category.book_set.all()
return render_to_response('category/view.html', {'category': category, 'book_list': book_list})
def IndexView(request):
return render_to_response('index.html')