summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCefin <kevon@tuta.io>2021-10-27 17:31:29 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-07-08 09:58:49 +0200
commit33efb94deb35fac36f9beb0b7320f9d9f92f7d09 (patch)
treef99332c5c1e599f9534349fb2ea4dcad81310dc7
parent52c3297e42a77c322539b324fd9a870a6b0e59e7 (diff)
downloadIshtar-33efb94deb35fac36f9beb0b7320f9d9f92f7d09.tar.bz2
Ishtar-33efb94deb35fac36f9beb0b7320f9d9f92f7d09.zip
search document by operation type #4698
-rw-r--r--ishtar_common/forms_common.py7
-rw-r--r--ishtar_common/models.py4
2 files changed, 10 insertions, 1 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index b689b7baf..821659828 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
@@ -1946,6 +1946,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,
@@ -2005,6 +2009,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 9c508c9fc..95fc2cef6 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -3694,6 +3694,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",