From 365546bcd78bed54c6ab2d7f375b86cde8caa66f Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 15 Feb 2018 16:53:36 +0100 Subject: Quick fix to manage ajax base finds in admin --- archaeological_finds/lookups.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'archaeological_finds/lookups.py') diff --git a/archaeological_finds/lookups.py b/archaeological_finds/lookups.py index 1449ff52b..5b30035ad 100644 --- a/archaeological_finds/lookups.py +++ b/archaeological_finds/lookups.py @@ -11,6 +11,16 @@ from archaeological_finds import models class BaseFindLookup(LookupChannel): model = models.BaseFind + def get_objects(self, items): + # TODO: why IDs are not given here? M2M issue + ids = [] + for item in items: + if hasattr(item, 'pk'): + ids.append(item.pk) + else: + ids.append(item) + return super(BaseFindLookup, self).get_objects(ids) + def get_query(self, q, request): query = Q() for term in q.strip().split(' '): -- cgit v1.2.3