summaryrefslogtreecommitdiff
path: root/ishtar_common/lookups.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/lookups.py')
-rw-r--r--ishtar_common/lookups.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/ishtar_common/lookups.py b/ishtar_common/lookups.py
index 9570f8bc6..f409536da 100644
--- a/ishtar_common/lookups.py
+++ b/ishtar_common/lookups.py
@@ -1,10 +1,22 @@
-from ajax_select import register, LookupChannel
+from ajax_select import register, LookupChannel as BaseLookupChannel
from django.conf import settings
from django.db.models import Q
from ishtar_common.models import Person, Organization, IshtarUser, Town, Author
+class LookupChannel(BaseLookupChannel):
+ 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(LookupChannel, self).get_objects(ids)
+
+
@register('town')
class TownLookup(LookupChannel):
model = Town