Fikset noen småfeil i Book.to_dict.
This commit is contained in:
parent
0106cb2453
commit
ca4ca01bf9
|
@ -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]
|
||||
|
|
Reference in New Issue