Mer fiksing på #12. Nå har alle hovedsider fått en liste (bøker, personer, kategorier), samt at forsida har fått en liste over kategorier.
This commit is contained in:
parent
25711283e8
commit
6782053f3c
|
@ -33,7 +33,10 @@ def BookView(request,book_identifier):
|
|||
|
||||
def BookRedirect(request,book_identifier):
|
||||
ident=get_object_or_404(Id,id=book_identifier)
|
||||
return HttpResponseRedirect('/bok/'+ident.book.isbn)
|
||||
return HttpResponseRedirect('/book/'+ident.book.isbn)
|
||||
|
||||
def BookIndex(request):
|
||||
return render_to_response('book/index.html', {'books': Book.objects.all().order_by('title')})
|
||||
|
||||
def PersonView(request,person_identifier):
|
||||
global relations
|
||||
|
@ -51,6 +54,9 @@ 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 PersonIndex(request):
|
||||
return render_to_response('person/index.html', {'persons': Person.objects.all().order_by('last_name')})
|
||||
|
||||
def MapIndex(request):
|
||||
return render_to_response('map/index.html', {'shelves': Placement.get_all_shelves()})
|
||||
|
||||
|
@ -69,7 +75,7 @@ def CategoryView(request,category_identifier):
|
|||
return render_to_response('category/view.html', {'category': category, 'book_list': book_list})
|
||||
|
||||
def IndexView(request):
|
||||
return render_to_response('index.html')
|
||||
return render_to_response('index.html', {'categories': Category.objects.all().order_by('name')})
|
||||
|
||||
def SearchView(request):
|
||||
if 'searchterm' in request.GET:
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
<h1>Worblehat</h1>
|
||||
<div class="links">
|
||||
<a href="/" class="link">Hjem</a> |
|
||||
<a href="/kart/" class="link">Kart</a> |
|
||||
<a href="/kart/" class="link">Hyllekart</a> |
|
||||
<a href="/kategori/" class="link">Kategorier</a> |
|
||||
<a href="/bok/" class="link">Bøker</a> |
|
||||
<a href="/person/" class="link">Forfattere</a> <br/>
|
||||
<a href="/person/" class="link">Forfattere og andre personer</a> <br/>
|
||||
</div>
|
||||
<hr/>
|
||||
{% block content %}
|
||||
|
|
|
@ -13,15 +13,6 @@
|
|||
{% if book.subtitle %}
|
||||
<h3>{{ book.subtitle }}</h3>
|
||||
{% endif %}
|
||||
<!---
|
||||
<span class="key">Title:</span> {{ book.title }} <br>
|
||||
{% if book.subtitle %}
|
||||
<span class="key">Subtitle:</span> {{ book.subtitle }} <br>
|
||||
{% endif %}
|
||||
{% for person in people %}
|
||||
<span class="key">{{ person.relation }}:</span> <a href=/person/{{person.person.id}}>{{ person.person.first_name }} {{ person.person.last_name }}</a> <br>
|
||||
{% endfor %}
|
||||
---!>
|
||||
{% for relation, persons in contributors.iteritems %}
|
||||
<span class="key">{{ relation }}{% if persons.0 != 1 and relation != 'Medvirkende' %}e{% endif %}:</span>
|
||||
{% for person in persons.1 %}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{% extends "base/main.html" %}
|
||||
|
||||
{%block title%}
|
||||
Worblehat 0.1: Kategorier
|
||||
Kategorier
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>Kategorier:</h3>
|
||||
<h2>Kategorier:</h2>
|
||||
<ul>
|
||||
{% for category in categories %}
|
||||
<li><a href="/kategori/{{ category.id }}">{{ category }}</a></li>
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
{% if not book_list %}
|
||||
Det finnes ingen bøker i denne kategorien.
|
||||
{% else %}
|
||||
<!---Følgende bøker finnes i denne kategorien:---!>
|
||||
<div class="key">Bøker:</div>
|
||||
<ul>
|
||||
{% for book in book_list %}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "base/main.html" %}
|
||||
|
||||
{% block title %}
|
||||
Worblehat 0.1. Heisann!!
|
||||
Heisann!!
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -13,10 +13,4 @@ Her kan du søke etter bøker til din hjertens lyst, eller gå direkte til <a hr
|
|||
<li><a href="/kategori/{{ category.id }}">{{ category }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<!---
|
||||
<form action="/let/" method="get">
|
||||
<input type="search" name="searchterm" placeholder="Søk etter bøker eller forfattere" autofocus>
|
||||
<input type="submit" value="Søk!">
|
||||
</form>
|
||||
---!>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "base/main.html" %}
|
||||
|
||||
{%block title%}
|
||||
Ferske, detaljerte og livsreddende kart!<!---Fresh, detailed, life-saving maps!---!>
|
||||
Hyllekart
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
|
|
@ -7,7 +7,6 @@ Søk
|
|||
{% block content %}
|
||||
<h2>Søk</h2>
|
||||
Du søkte på <b>{{ search_string }}</b>.<br/><br/>
|
||||
<!---Fant du ikke det du lette etter? <a href="/">Søk på nytt.</a><br/><br/>---!>
|
||||
{% if people %}
|
||||
<span class="key">Personer:</span><br/>
|
||||
{% for person in people %}
|
||||
|
|
|
@ -12,9 +12,11 @@ urlpatterns = patterns('',
|
|||
# to INSTALLED_APPS to enable admin documentation:
|
||||
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
(r'^media/(?P<path>.*)$','django.views.static.serve',{'document_root' : settings.MEDIA_ROOT}),
|
||||
(r'^bok/$','web.library.views.BookIndex'),
|
||||
(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'^person/$','web.library.views.PersonIndex'),
|
||||
(r'^kart/$','web.library.views.MapIndex'),
|
||||
(r'^kart/(?P<shelf_identifier>\S+)/$','web.library.views.MapView'),
|
||||
(r'^kategori/$','web.library.views.CategoryIndex'),
|
||||
|
|
Reference in New Issue