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

Fikset noen småfeil i Book.to_dict.

This commit is contained in:
Øystein Ingmar Skartsæterhagen 2011-03-05 18:40:17 +00:00
parent 0106cb2453
commit ca4ca01bf9
1 changed files with 6 additions and 5 deletions

View File

@ -76,15 +76,16 @@ class Book(models.Model):
people = self.persons.all()
dict['persons'] = {}
for person in people:
if person.relation.name in dict['persons']:
dict['persons'][person.relation.name].append(person.id)
for bookperson in people:
person = bookperson.person
if bookperson.relation.name in dict['persons']:
dict['persons'][bookperson.relation.name].append(person.id)
else:
dict['persons'][person.relation.name] = [person.id]
dict['persons'][bookperson.relation.name] = [person.id]
dict['references'] = {}
for reference in self.references.all():
if person.relation.name in dict['references']:
if reference.reference_type.name in dict['references']:
dict['references'][reference.reference_type.name].append(reference.text)
else:
dict['references'][reference.reference_type.name] = [reference.text]