diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-08-30 17:49:23 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-12 12:23:18 +0100 |
commit | e4df561285b6fbda6b57477b7fa59ca9168e83e7 (patch) | |
tree | e5b754cef2aa2b00739f68dd6ef1bba8f37bef8a /archaeological_warehouse | |
parent | 44596cec7f75552a823143ce1a416097cc8ee28c (diff) | |
download | Ishtar-e4df561285b6fbda6b57477b7fa59ca9168e83e7.tar.bz2 Ishtar-e4df561285b6fbda6b57477b7fa59ca9168e83e7.zip |
Fix many count search such has "has-finds" (refs #5425)
Diffstat (limited to 'archaeological_warehouse')
-rw-r--r-- | archaeological_warehouse/forms.py | 3 | ||||
-rw-r--r-- | archaeological_warehouse/models.py | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index 57fc31f4f..e942878a7 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -512,7 +512,8 @@ class ContainerSelect(DocumentItemSelect): old_reference = forms.CharField(label=_("Old reference")) comment = forms.CharField(label=_("Comment")) contain_containers = forms.NullBooleanField(label=_("Contain containers")) - empty = forms.NullBooleanField(label=_("Currently empty")) + ## to be rethink: the current request if it has got finds directly inside + # empty = forms.NullBooleanField(label=_("Currently empty")) is_stationary = forms.NullBooleanField(label=_("Is stationary")) parent = forms.IntegerField( label=_("Parent container"), diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 2e2aae732..9a8bc86c2 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -1004,7 +1004,8 @@ class Container( pgettext_lazy("key for text search", "find-description"), "finds__description__iexact", ), - "empty": SearchAltName(pgettext_lazy("key for text search", "empty"), "finds"), + "empty": SearchAltName(pgettext_lazy("key for text search", "empty"), + "finds__isnull"), "parent": SearchAltName( pgettext_lazy("key for text search", "parent-container"), "parent__cached_label__iexact", @@ -1025,7 +1026,7 @@ class Container( "documents__associated_url__isnull", ] BOOL_FIELDS = LightHistorizedItem.BOOL_FIELDS + ["container_type__stationary"] - REVERSED_MANY_COUNTED_FIELDS = ["finds", "finds_ref"] + REVERSED_MANY_COUNTED_FIELDS = ["finds__isnull", "finds_ref"] ALT_NAMES.update(LightHistorizedItem.ALT_NAMES) ALT_NAMES.update(DocumentItem.ALT_NAMES) |