Lagt til html-visning av kategorier og en oversikt over hyller.
This commit is contained in:
parent
acb9bd6501
commit
79c73b2502
|
@ -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')
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
{% extends "base/main.html" %}
|
||||
|
||||
{%block title%}
|
||||
Worblehat 0.1: Kategorier
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>Kategorier:</h3>
|
||||
<ul>
|
||||
{% for category in categories %}
|
||||
<li><a href="/kategori/{{ category.id }}">{{ category }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
|
@ -0,0 +1,23 @@
|
|||
{% extends "base/main.html" %}
|
||||
|
||||
{%block title%}
|
||||
Worblehat 0.1: Kategori: {{ category }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{{ category }}<br />
|
||||
|
||||
{% if not book_list %}
|
||||
Det finnes ingen bøker i denne kategorien.
|
||||
{% else %}
|
||||
Følgende bøker finnes i denne kategorien:
|
||||
<ul>
|
||||
{% for book in book_list %}
|
||||
<li><a href="/bok/{{ book.id }}">{{ book }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
{% extends "base/main.html" %}
|
||||
|
||||
{%block title%}
|
||||
Worblehat 0.1: Fresh, detailed, life-saving maps!
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Hyller:
|
||||
<ul>
|
||||
{% for shelf_name in shelves %}
|
||||
<li><a href="/kart/{{ shelf_name }}">{{ shelf_name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "base/main.html" %}
|
||||
|
||||
{%block title%}
|
||||
Worblehat 0.1: Fresh, detailed, life-saving maps!
|
||||
Worblehat 0.1: Hylle {{ shelf_name }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -12,7 +12,7 @@ Worblehat 0.1: Fresh, detailed, life-saving maps!
|
|||
<td>
|
||||
<table>
|
||||
{% for category in column %}
|
||||
<tr><td><a href="/category/{{ category.id }}"> {{ category }} </a></td></tr>
|
||||
<tr><td><a href="/kategori/{{ category.id }}">{{ category }}</a></td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</td>
|
||||
|
|
|
@ -15,7 +15,10 @@ urlpatterns = patterns('',
|
|||
(r'^bok/(?P<book_identifier>\d+)/$','web.library.views.BookView'),
|
||||
(r'^bok/(?P<book_identifier>\S+)/$','web.library.views.BookRedirect'),
|
||||
(r'^person/(?P<person_identifier>\S+)/$','web.library.views.PersonView'),
|
||||
(r'^kart/(?P<shelf_identifier>\S+)/$', 'web.library.views.MapView'),
|
||||
(r'^kart/$','web.library.views.MapIndex'),
|
||||
(r'^kart/(?P<shelf_identifier>\S+)/$','web.library.views.MapView'),
|
||||
(r'^kategori/$','web.library.views.CategoryIndex'),
|
||||
(r'^kategori/(?P<category_identifier>\S+)/$','web.library.views.CategoryView'),
|
||||
# Uncomment the next line to enable the admin:
|
||||
(r'^admin/', include(admin.site.urls)),
|
||||
(r'^let/','web.library.views.SearchView'),
|
||||
|
|
Reference in New Issue