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

Har forhåpentligvis fikset problemer med forløkke.

This commit is contained in:
Tiril Anette Langfeldt Rødland 2011-03-06 17:51:16 +00:00
parent b85ad52ed4
commit acb9bd6501
3 changed files with 6 additions and 7 deletions

View File

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

View File

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

View File

@ -11,10 +11,6 @@ Worblehat: {{ person.first_name }} {{ person.last_name }}
<ul>
{% for book in books.1 %}
<li> <a href=/bok/{{book.book.isbn}}>{{ book.book.title }}</a>
<!--- <span class="key">Name:</span> {{person.first_name}} {{person.last_name}}<br>
{% for book in books %}
<span class="key">{{ book.relation.name }} of:</span> <a href=/bok/{{ book.book.isbn }}>{{ book.book.title }}</a> <br>
---!>
{% endfor %}
<br/>
</ul>