summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCefin <kevon@tuta.io>2022-08-17 09:48:55 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:23:17 +0100
commit5d9d9a35eb15eb5cfee880ca1ef185dcf16b2817 (patch)
tree3ce6ae733489b2eefaf9aa339497d0e48c591955
parent30017b9b88d78112325ed89c4d11a2a72a54a64a (diff)
downloadIshtar-5d9d9a35eb15eb5cfee880ca1ef185dcf16b2817.tar.bz2
Ishtar-5d9d9a35eb15eb5cfee880ca1ef185dcf16b2817.zip
WIP: add "is locked" search (refs #5419)
-rw-r--r--archaeological_finds/models_finds.py2
-rw-r--r--archaeological_operations/models.py2
-rw-r--r--ishtar_common/forms.py3
-rw-r--r--ishtar_common/models_common.py5
4 files changed, 11 insertions, 1 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index d0e31c3e8..fb695ba73 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -1176,7 +1176,7 @@ class Find(
"documents__associated_url__isnull",
"documents__associated_file__isnull",
]
- BOOL_FIELDS = ["is_complete"]
+ BOOL_FIELDS = BaseHistorizedItem.BOOL_FIELDS + ["is_complete"]
CALLABLE_BOOL_FIELDS = ["loan"]
RELATION_TYPES_PREFIX = {
"ope_relation_types": "base_finds__context_record__operation__",
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 3ee2cf20e..1567fecc6 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -310,6 +310,8 @@ class ArchaeologicalSite(
DATED_FIELDS = BaseHistorizedItem.DATED_FIELDS + ["sinking_date"]
+ BOOL_FIELDS = BaseHistorizedItem.BOOL_FIELDS
+
EXTRA_REQUEST_KEYS = {
"towns_label": "towns",
"collaborators__pk": "collaborators__pk", # dynamic_table_documents
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py
index 020d54198..d181b975d 100644
--- a/ishtar_common/forms.py
+++ b/ishtar_common/forms.py
@@ -942,12 +942,15 @@ class HistorySelect(CustomForm, TableSelect):
modified_after = forms.DateField(
label=_("Modified after"), widget=DatePicker, required=False
)
+ locked = forms.BooleanField(label=_("Is locked ?"))
_explicit_ordering = True
+
CURRENT_FIELDS = [
"history_creator",
"history_modifier",
"modified_before",
"modified_after",
+ "locked",
]
def __init__(self, *args, **kwargs):
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index d6d9fb4ae..d1b20215b 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -1428,6 +1428,8 @@ class BaseHistorizedItem(
"last_modified__lte",
]
+ BOOL_FIELDS = ["locked"]
+
ALT_NAMES = {
"history_creator": SearchAltName(
pgettext_lazy("key for text search", "created-by"),
@@ -1444,6 +1446,9 @@ class BaseHistorizedItem(
"modified_after": SearchAltName(
pgettext_lazy("key for text search", "modified-after"), "last_modified__gte"
),
+ "locked": SearchAltName(
+ pgettext_lazy("key for text search", "locked"), "locked__test"
+ )
}
class Meta: