From aa0fbc9d4a93c90a5af0922d402d65412b6b5229 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Tue, 19 Apr 2016 15:08:55 +0100 Subject: [PATCH] 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. --- pandora/entity/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora/entity/models.py b/pandora/entity/models.py index faff0e25..d515937f 100644 --- a/pandora/entity/models.py +++ b/pandora/entity/models.py @@ -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