summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-02-23 17:07:51 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-04-16 16:42:32 +0200
commita634566637d52380f1289be46bdcfd9e636f31af (patch)
treee62209947a53334d75641677fbb0051bd01d6061
parentcdfacfb5f6881dc284ee7a4706fa673375ac0850 (diff)
downloadIshtar-a634566637d52380f1289be46bdcfd9e636f31af.tar.bz2
Ishtar-a634566637d52380f1289be46bdcfd9e636f31af.zip
✨ document related search: search by document type
-rw-r--r--ishtar_common/forms.py5
-rw-r--r--ishtar_common/models_common.py4
2 files changed, 9 insertions, 0 deletions
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py
index b81b42bc6..3dffc77c4 100644
--- a/ishtar_common/forms.py
+++ b/ishtar_common/forms.py
@@ -1029,11 +1029,16 @@ class DocumentItemSelect(ImportSelect):
documents__associated_url__isnull = forms.NullBooleanField(
label=_("Has a web address?")
)
+ documents__source_type = forms.ChoiceField(label=_("Document - Type"), choices=[])
CURRENT_FIELDS = [
"documents__image__isnull",
"documents__associated_file__isnull",
"documents__associated_url__isnull",
+ "documents__source_type",
] + ImportSelect.CURRENT_FIELDS
+ TYPES = [
+ FieldType("documents__source_type", models.SourceType),
+ ] + ImportSelect.TYPES
_explicit_ordering = True
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index 38aa6fc51..8a9de207e 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -1833,6 +1833,10 @@ class DocumentItem:
pgettext_lazy("key for text search", "has-attached-file"),
"documents__associated_file__isnull",
),
+ "documents__source_type": SearchAltName(
+ pgettext_lazy("key for text search", "document-type"),
+ "documents__source_type__label__iexact",
+ ),
}
def documents_list(self) -> list: