diff options
author | Cefin <kevon@tuta.io> | 2021-10-27 17:31:29 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-11-16 17:04:41 +0100 |
commit | 3d4a0d8741ba9b3f7eb42f3d49726e673e08136f (patch) | |
tree | 24504c98909fe6e93ab282d6640c9a9806173847 | |
parent | 1541e2419f9c85c65a8658457bc4a01a8f95bb02 (diff) | |
download | Ishtar-3d4a0d8741ba9b3f7eb42f3d49726e673e08136f.tar.bz2 Ishtar-3d4a0d8741ba9b3f7eb42f3d49726e673e08136f.zip |
search document by operation type #4698
-rw-r--r-- | ishtar_common/forms_common.py | 7 | ||||
-rw-r--r-- | ishtar_common/models.py | 4 |
2 files changed, 10 insertions, 1 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 935436eaa..9c9611778 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -71,7 +71,7 @@ from .forms import ( from ishtar_common.data_importer import ImporterError from ishtar_common.utils import is_downloadable, clean_session_cache, max_size_help -from archaeological_operations.models import Operation +from archaeological_operations.models import Operation, OperationType from archaeological_context_records.models import ContextRecord from archaeological_finds.models import Find, FindBasket from archaeological_warehouse.models import Container @@ -1930,6 +1930,10 @@ class DocumentSelect(HistorySelect): ), validators=[models.valid_id(Operation)], ) + operations__operation_type = forms.ChoiceField( + label=_("Operation type"), + choices=[] + ) context_record = forms.IntegerField( label=_("Context record"), required=False, @@ -1989,6 +1993,7 @@ class DocumentSelect(HistorySelect): FieldType("tag", models.DocumentTag), FieldType("language", models.Language), FieldType("licenses", models.LicenseType), + FieldType("operations__operation_type", models.OperationType), ] PROFILE_FILTER = { diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 0e3051e28..43dc5ed51 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -3685,6 +3685,10 @@ class Document( pgettext_lazy("key for text search", "operation"), "operations__cached_label__iexact", ), + "operations__operation_type": SearchAltName( + pgettext_lazy("key for text search", "operation-type"), + "operations__operation_type__label__iexact", + ), "context_record": SearchAltName( pgettext_lazy("key for text search", "context-record"), "context_records__cached_label__iexact", |