summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-08-17 14:54:02 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:23:17 +0100
commit47b8c7e1acddb890ecce1e7f13352bd5b31d8d24 (patch)
treeb4f5caee4458929bddb2371863abd9a2d1163ee8
parent5d9d9a35eb15eb5cfee880ca1ef185dcf16b2817 (diff)
downloadIshtar-47b8c7e1acddb890ecce1e7f13352bd5b31d8d24.tar.bz2
Ishtar-47b8c7e1acddb890ecce1e7f13352bd5b31d8d24.zip
Add "is locked" search (refs #5419)
-rw-r--r--archaeological_files/models.py2
-rw-r--r--archaeological_operations/models.py4
-rw-r--r--archaeological_warehouse/models.py2
-rw-r--r--ishtar_common/forms.py3
-rw-r--r--ishtar_common/models.py2
-rw-r--r--ishtar_common/models_common.py2
-rw-r--r--ishtar_common/views_item.py4
7 files changed, 9 insertions, 10 deletions
diff --git a/archaeological_files/models.py b/archaeological_files/models.py
index f737472a1..2cd42d5ba 100644
--- a/archaeological_files/models.py
+++ b/archaeological_files/models.py
@@ -396,7 +396,7 @@ class File(
)
# search parameters
- BOOL_FIELDS = ["end_date__isnull"]
+ BOOL_FIELDS = BaseHistorizedItem.BOOL_FIELDS + ["end_date__isnull"]
EXTRA_REQUEST_KEYS = {
"parcel_0": ("parcels__section", "operations__parcels__section"),
"parcel_1": ("parcels__parcel_number", "operations__parcels__parcel_number"),
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 1567fecc6..ae52e5cbe 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -310,8 +310,6 @@ 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
@@ -919,7 +917,7 @@ class Operation(
STATISTIC_MODALITIES = [key for key, lbl in STATISTIC_MODALITIES_OPTIONS.items()]
# search parameters
- BOOL_FIELDS = [
+ BOOL_FIELDS = BaseHistorizedItem.BOOL_FIELDS + [
"end_date__isnull",
"virtual_operation",
"documentation_received",
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
index 996925d0a..2e2aae732 100644
--- a/archaeological_warehouse/models.py
+++ b/archaeological_warehouse/models.py
@@ -1024,7 +1024,7 @@ class Container(
"documents__associated_file__isnull",
"documents__associated_url__isnull",
]
- BOOL_FIELDS = ["container_type__stationary"]
+ BOOL_FIELDS = LightHistorizedItem.BOOL_FIELDS + ["container_type__stationary"]
REVERSED_MANY_COUNTED_FIELDS = ["finds", "finds_ref"]
ALT_NAMES.update(LightHistorizedItem.ALT_NAMES)
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py
index d181b975d..5a16a508f 100644
--- a/ishtar_common/forms.py
+++ b/ishtar_common/forms.py
@@ -942,7 +942,7 @@ class HistorySelect(CustomForm, TableSelect):
modified_after = forms.DateField(
label=_("Modified after"), widget=DatePicker, required=False
)
- locked = forms.BooleanField(label=_("Is locked ?"))
+ locked = forms.NullBooleanField(label=_("Is locked?"))
_explicit_ordering = True
CURRENT_FIELDS = [
@@ -983,6 +983,7 @@ class DocumentItemSelect(HistorySelect):
"history_modifier",
"modified_before",
"modified_after",
+ "locked",
]
_explicit_ordering = True
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 0ee33d5ed..e7520ee95 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -3803,7 +3803,7 @@ class Document(
SearchVectorConfig("tags__label"),
]
- BOOL_FIELDS = ["duplicate"]
+ BOOL_FIELDS = BaseHistorizedItem.BOOL_FIELDS + ["duplicate"]
COL_LABELS = {
"authors__cached_label": _("Authors"),
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index d1b20215b..b2cb095e6 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -1447,7 +1447,7 @@ class BaseHistorizedItem(
pgettext_lazy("key for text search", "modified-after"), "last_modified__gte"
),
"locked": SearchAltName(
- pgettext_lazy("key for text search", "locked"), "locked__test"
+ pgettext_lazy("key for text search", "locked"), "locked"
)
}
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index 68a340a75..5d1ed582a 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -1921,8 +1921,8 @@ def get_item(
my_relation_types_prefix["relation_types"] = ""
relation_types = _get_relation_type_dict(my_relation_types_prefix, dct)
- exc_relation_types =_get_relation_type_dict(my_relation_types_prefix,
- excluded_dct)
+ exc_relation_types = _get_relation_type_dict(my_relation_types_prefix,
+ excluded_dct)
_manage_bool_fields(
model, my_bool_fields, my_reversed_bool_fields, dct, or_reqs