From acb9bd65014abf0a0a46698851999eb82cc2e75d Mon Sep 17 00:00:00 2001 From: tirilane Date: Sun, 6 Mar 2011 17:51:16 +0000 Subject: [PATCH] =?UTF-8?q?Har=20forh=C3=A5pentligvis=20fikset=20problemer?= =?UTF-8?q?=20med=20forl=C3=B8kke.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/web/library/models.py | 4 ++++ python/web/library/views.py | 5 ++--- python/web/templates/person/view.html | 4 ---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/python/web/library/models.py b/python/web/library/models.py index 6824a4b..fd4db02 100644 --- a/python/web/library/models.py +++ b/python/web/library/models.py @@ -135,6 +135,7 @@ class Book(models.Model): # print '%13s %5s %30s %' # class Meta: +# order_with_respect_to = 'published_year' # unique_together=(("isbn","id"),) class Reference(models.Model): @@ -198,6 +199,9 @@ class Person(models.Model): def __unicode__(self): return self.first_name + u' ' + self.last_name +# class Meta: +# order_with_respect_to = 'last_name' + class Relation(models.Model): name = models.CharField(max_length=31, primary_key=True) diff --git a/python/web/library/views.py b/python/web/library/views.py index 8874222..949dbf6 100644 --- a/python/web/library/views.py +++ b/python/web/library/views.py @@ -10,7 +10,7 @@ relations = {'Author' : u'Forfatter', 'Illustrator' : u'Tegner', 'Translator' : # Create your views here. def BookView(request,book_identifier): book=get_object_or_404(Book,isbn=book_identifier) - people = book.persons.all() + people = book.persons.all().order_by('person') shelves = None global relations if book.category: @@ -18,7 +18,6 @@ def BookView(request,book_identifier): shelves = book.category.placement.all() contributors = {} for person in people: - print person.relation if str(person.relation) in relations: relation = relations[str(person.relation)] else: @@ -39,7 +38,7 @@ def BookRedirect(request,book_identifier): def PersonView(request,person_identifier): global relations person = get_object_or_404(Person,id=person_identifier) - books = person.books.all() + books = person.books.all().order_by('book') contributed = {} for book in books: if str(book.relation) in relations: diff --git a/python/web/templates/person/view.html b/python/web/templates/person/view.html index f8d9483..78d2f79 100644 --- a/python/web/templates/person/view.html +++ b/python/web/templates/person/view.html @@ -11,10 +11,6 @@ Worblehat: {{ person.first_name }} {{ person.last_name }}