diff --git a/python/web/library/views.py b/python/web/library/views.py index 949dbf6..09a7b36 100644 --- a/python/web/library/views.py +++ b/python/web/library/views.py @@ -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') diff --git a/python/web/templates/category/index.html b/python/web/templates/category/index.html new file mode 100644 index 0000000..fc00aca --- /dev/null +++ b/python/web/templates/category/index.html @@ -0,0 +1,14 @@ +{% extends "base/main.html" %} + +{%block title%} +Worblehat 0.1: Kategorier +{% endblock %} + +{% block content %} +
{{ category }} |
{{ category }} |