12
0

Har forhåpentligvis fikset problemer med forløkke.

This commit is contained in:
2011-03-06 17:51:16 +00:00
parent b85ad52ed4
commit acb9bd6501
3 changed files with 6 additions and 7 deletions
python/web
library
templates
person

@@ -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)

@@ -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: