summaryrefslogtreecommitdiff
path: root/ishtar_common/lookups.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-11-27 11:26:55 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:21 +0100
commit975b971ae6efacbd5614be7f057f32d7c302966b (patch)
tree300713d38252ed0fb9d25e48e8499b29523b7985 /ishtar_common/lookups.py
parent30bf32d6768f3c013b44e1ed76d94f9954d6e565 (diff)
downloadIshtar-975b971ae6efacbd5614be7f057f32d7c302966b.tar.bz2
Ishtar-975b971ae6efacbd5614be7f057f32d7c302966b.zip
Documents: dynamic filter of support and medium by document type - collapse related fields on edition
Diffstat (limited to 'ishtar_common/lookups.py')
-rw-r--r--ishtar_common/lookups.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/ishtar_common/lookups.py b/ishtar_common/lookups.py
index 3481ba1a9..66b43f3e4 100644
--- a/ishtar_common/lookups.py
+++ b/ishtar_common/lookups.py
@@ -156,3 +156,12 @@ class DocumentLookup(LookupChannel):
internal_reference__icontains=q
)
return self.model.objects.filter(query).order_by('title')[:20]
+
+
+@register('source_type')
+class SourceTypeLookup(LookupChannel):
+ model = models.SourceType
+
+ def get_query(self, q, request):
+ query = Q(label__icontains=q)
+ return self.model.objects.filter(query).order_by('label')[:20]