diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-10-13 13:07:38 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-10-13 13:07:38 +0200 |
commit | 56279d5d629d325d2235862537e4fc2935684c49 (patch) | |
tree | abc60adb476d69cfe020ce9d39a252d4c667f355 | |
parent | 5299f1f9c86bfe99e0e1a4c50a444fd55e07ee6c (diff) | |
download | Ishtar-56279d5d629d325d2235862537e4fc2935684c49.tar.bz2 Ishtar-56279d5d629d325d2235862537e4fc2935684c49.zip |
Find/context record search: change search order, terms, fix search field
-rw-r--r-- | archaeological_context_records/models.py | 2 | ||||
-rw-r--r-- | archaeological_finds/forms.py | 42 | ||||
-rw-r--r-- | archaeological_finds/models_finds.py | 8 | ||||
-rw-r--r-- | archaeological_finds/tests.py | 2 |
4 files changed, 32 insertions, 22 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 311f9625b..151446c2d 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -543,7 +543,7 @@ class ContextRecord( "cr_relation_types", ), "excavation_technic": SearchAltName( - pgettext_lazy("key for text search", "excavation-technic"), + pgettext_lazy("key for text search", "excavation-technique"), "excavation_technic__label__iexact", ), } diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index a99d6fed4..da394c1ef 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -62,7 +62,7 @@ from ishtar_common.forms_common import get_town_field from archaeological_context_records.forms import PeriodSelect from ishtar_common.models import valid_id, valid_ids, get_current_profile, \ - SpatialReferenceSystem, Area, OperationType, IshtarUser + SpatialReferenceSystem, Area, OperationType, IshtarUser, Person, person_type_pks_lazy from ishtar_common.utils import convert_coordinates_to_point __all__ = [ @@ -1016,23 +1016,6 @@ class FindSelect(DocumentItemSelect, PeriodSelect): label=_("Full text search"), widget=widgets.SearchWidget( 'archaeological-finds', 'find' )) - base_finds__context_record__operation__address = forms.CharField(label=_("Address")) - base_finds__context_record__operation__person_in_charge = forms.IntegerField( - label=_("Person in charge"), - widget=widgets.JQueryAutoComplete( - reverse_lazy("autocomplete-person") - ) - ) - base_finds__context_record__operation__operator = forms.IntegerField( - label=_("Operator"), - widget=widgets.JQueryAutoComplete( - reverse_lazy("autocomplete-organization") - ) - ) - base_finds__context_record__operation__common_name = forms.CharField( - label=_("Operation name"), - max_length=30 - ) label = forms.CharField(label=_("Free ID")) denomination = forms.CharField(label=_("Denomination")) previous_id = forms.CharField(label=_("Previous ID")) @@ -1059,6 +1042,29 @@ class FindSelect(DocumentItemSelect, PeriodSelect): base_finds__context_record__operation__operation_type = forms.ChoiceField( label=_("Operation type"), choices=[] ) + base_finds__context_record__operation__address = forms.CharField(label=_("Operation - Address / Locality")) + base_finds__context_record__operation__in_charge = forms.IntegerField( + label=_("Operation - In charge"), + widget=widgets.JQueryAutoComplete( + reverse_lazy("autocomplete-person") + ) + ) + base_finds__context_record__operation__scientist = forms.IntegerField( + widget=widgets.JQueryAutoComplete( + reverse_lazy( + 'autocomplete-person-permissive', + args=[person_type_pks_lazy(['sra_agent', 'head_scientist'])]), + associated_model=Person), + label=_("Operation - Scientist in charge")) + base_finds__context_record__operation__operator = forms.IntegerField( + label=_("Operation - Operator"), + widget=widgets.JQueryAutoComplete( + reverse_lazy("autocomplete-organization") + ) + ) + base_finds__context_record__operation__common_name = forms.CharField( + label=_("Operation - Name"), + ) base_finds__context_record__town__areas = forms.ChoiceField( label=_("Areas"), choices=[] ) diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 0968b121f..25ddc5aa6 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1585,16 +1585,20 @@ class Find( "base_finds__context_record__operation__address__iexact", ), "base_finds__context_record__operation__in_charge": SearchAltName( - pgettext_lazy("key for text search", "person-in-charge"), + pgettext_lazy("key for text search", "in-charge"), "base_finds__context_record__operation__in_charge__cached_label__iexact", ), + "base_finds__context_record__operation__scientist": SearchAltName( + pgettext_lazy("key for text search", "scientist"), + "base_finds__context_record__operation__scientist__cached_label__iexact", + ), "base_finds__context_record__operation__operator": SearchAltName( pgettext_lazy("key for text search", "operator"), "base_finds__context_record__operation__operator__cached_label__iexact", ), "base_finds__context_record__operation__common_name": SearchAltName( pgettext_lazy("key for text search", "operation-name"), - "base_finds__context_record__operation__common_name__icontains", + "base_finds__context_record__operation__common_name__iexact", ), } ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES) diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index b995de58b..924e205ed 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -1320,7 +1320,7 @@ class FindSearchTest(FindInit, TestCase, SearchText): c = Client() c.login(username=self.username, password=self.password) - key = str(pgettext_lazy("key for text search", "person-in-charge")) + key = str(pgettext_lazy("key for text search", "in-charge")) result = [ ('{}="{}"'.format(key, "HISNAME Michel"), 1) ] |