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()
|
people = self.persons.all()
|
||||||
dict['persons'] = {}
|
dict['persons'] = {}
|
||||||
for person in people:
|
for bookperson in people:
|
||||||
if person.relation.name in dict['persons']:
|
person = bookperson.person
|
||||||
dict['persons'][person.relation.name].append(person.id)
|
if bookperson.relation.name in dict['persons']:
|
||||||
|
dict['persons'][bookperson.relation.name].append(person.id)
|
||||||
else:
|
else:
|
||||||
dict['persons'][person.relation.name] = [person.id]
|
dict['persons'][bookperson.relation.name] = [person.id]
|
||||||
|
|
||||||
dict['references'] = {}
|
dict['references'] = {}
|
||||||
for reference in self.references.all():
|
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)
|
dict['references'][reference.reference_type.name].append(reference.text)
|
||||||
else:
|
else:
|
||||||
dict['references'][reference.reference_type.name] = [reference.text]
|
dict['references'][reference.reference_type.name] = [reference.text]
|
||||||
|
|
Reference in New Issue