Projects/worblehat-old
Projects
/
worblehat-old
Archived
12
0
Fork 0

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:
Tiril Anette Langfeldt Rødland 2011-03-06 20:40:41 +00:00
parent 25711283e8
commit 6782053f3c
9 changed files with 16 additions and 25 deletions

View File

@ -33,7 +33,10 @@ def BookView(request,book_identifier):
def BookRedirect(request,book_identifier): def BookRedirect(request,book_identifier):
ident=get_object_or_404(Id,id=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): def PersonView(request,person_identifier):
global relations global relations
@ -51,6 +54,9 @@ def PersonView(request,person_identifier):
contributed[relation][1].append(book) 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 }) 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): def MapIndex(request):
return render_to_response('map/index.html', {'shelves': Placement.get_all_shelves()}) 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}) return render_to_response('category/view.html', {'category': category, 'book_list': book_list})
def IndexView(request): 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): def SearchView(request):
if 'searchterm' in request.GET: if 'searchterm' in request.GET:

View File

@ -12,10 +12,10 @@
<h1>Worblehat</h1> <h1>Worblehat</h1>
<div class="links"> <div class="links">
<a href="/" class="link">Hjem</a> | <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="/kategori/" class="link">Kategorier</a> |
<a href="/bok/" class="link">Bøker</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> </div>
<hr/> <hr/>
{% block content %} {% block content %}

View File

@ -13,15 +13,6 @@
{% if book.subtitle %} {% if book.subtitle %}
<h3>{{ book.subtitle }}</h3> <h3>{{ book.subtitle }}</h3>
{% endif %} {% 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 %} {% for relation, persons in contributors.iteritems %}
<span class="key">{{ relation }}{% if persons.0 != 1 and relation != 'Medvirkende' %}e{% endif %}:</span> <span class="key">{{ relation }}{% if persons.0 != 1 and relation != 'Medvirkende' %}e{% endif %}:</span>
{% for person in persons.1 %} {% for person in persons.1 %}

View File

@ -1,11 +1,11 @@
{% extends "base/main.html" %} {% extends "base/main.html" %}
{%block title%} {%block title%}
Worblehat 0.1: Kategorier Kategorier
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h3>Kategorier:</h3> <h2>Kategorier:</h2>
<ul> <ul>
{% for category in categories %} {% for category in categories %}
<li><a href="/kategori/{{ category.id }}">{{ category }}</a></li> <li><a href="/kategori/{{ category.id }}">{{ category }}</a></li>

View File

@ -11,7 +11,6 @@
{% if not book_list %} {% if not book_list %}
Det finnes ingen bøker i denne kategorien. Det finnes ingen bøker i denne kategorien.
{% else %} {% else %}
<!---Følgende bøker finnes i denne kategorien:---!>
<div class="key">Bøker:</div> <div class="key">Bøker:</div>
<ul> <ul>
{% for book in book_list %} {% for book in book_list %}

View File

@ -1,7 +1,7 @@
{% extends "base/main.html" %} {% extends "base/main.html" %}
{% block title %} {% block title %}
Worblehat 0.1. Heisann!! Heisann!!
{% endblock %} {% endblock %}
{% block content %} {% 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> <li><a href="/kategori/{{ category.id }}">{{ category }}</a></li>
{% endfor %} {% endfor %}
</ul> </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 %} {% endblock %}

View File

@ -1,7 +1,7 @@
{% extends "base/main.html" %} {% extends "base/main.html" %}
{%block title%} {%block title%}
Ferske, detaljerte og livsreddende kart!<!---Fresh, detailed, life-saving maps!---!> Hyllekart
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@ -7,7 +7,6 @@ Søk
{% block content %} {% block content %}
<h2>Søk</h2> <h2>Søk</h2>
Du søkte på <b>{{ search_string }}</b>.<br/><br/> 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 %} {% if people %}
<span class="key">Personer:</span><br/> <span class="key">Personer:</span><br/>
{% for person in people %} {% for person in people %}

View File

@ -12,9 +12,11 @@ urlpatterns = patterns('',
# to INSTALLED_APPS to enable admin documentation: # to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')), # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^media/(?P<path>.*)$','django.views.static.serve',{'document_root' : settings.MEDIA_ROOT}), (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>\d+)/$','web.library.views.BookView'),
(r'^bok/(?P<book_identifier>\S+)/$','web.library.views.BookRedirect'), (r'^bok/(?P<book_identifier>\S+)/$','web.library.views.BookRedirect'),
(r'^person/(?P<person_identifier>\S+)/$','web.library.views.PersonView'), (r'^person/(?P<person_identifier>\S+)/$','web.library.views.PersonView'),
(r'^person/$','web.library.views.PersonIndex'),
(r'^kart/$','web.library.views.MapIndex'), (r'^kart/$','web.library.views.MapIndex'),
(r'^kart/(?P<shelf_identifier>\S+)/$','web.library.views.MapView'), (r'^kart/(?P<shelf_identifier>\S+)/$','web.library.views.MapView'),
(r'^kategori/$','web.library.views.CategoryIndex'), (r'^kategori/$','web.library.views.CategoryIndex'),