Entity.json: get document ids from join table

This is a bit quicker because it's just a lookup in a single table, not
a join.
This commit is contained in:
Will Thompson 2016-04-19 15:08:55 +01:00
parent 400b6650a2
commit aa0fbc9d4a
No known key found for this signature in database
GPG Key ID: 3422DC0D7AD482A7
1 changed files with 2 additions and 2 deletions

View File

@ -168,8 +168,8 @@ class Entity(models.Model):
elif key == 'sortName':
response[key] = self.name_sort
elif key == 'documents':
response[key] = [ox.toAZ(d['id'])
for d in self.documents.all().values('id').order_by('documentproperties__index')]
response[key] = [ox.toAZ(id_)
for id_, in self.documentproperties.order_by('index').values_list('document_id')]
elif key in self.data:
response[key] = self.data[key]
return response