From 8355b16b1ae2f213de8d9f98221227f587e3b29f Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 27 Nov 2020 11:26:55 +0100 Subject: Documents: dynamic filter of support and medium by document type - collapse related fields on edition --- ishtar_common/lookups.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ishtar_common/lookups.py') 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] -- cgit v1.2.3