diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-03-21 14:57:49 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-03-21 14:57:49 +0100 |
commit | b37fea20fd79ecc0f7174dda57720f61efb4989b (patch) | |
tree | 615d13cd567d4e090deac43d4040725cc347d5d1 | |
parent | deb4124adc6be428df2b79f6ae4615b3ef5dc35d (diff) | |
download | Ishtar-b37fea20fd79ecc0f7174dda57720f61efb4989b.tar.bz2 Ishtar-b37fea20fd79ecc0f7174dda57720f61efb4989b.zip |
Finds search: search by warehouse (location & responsible) (refs #3416)
-rw-r--r-- | archaeological_finds/forms.py | 14 | ||||
-rw-r--r-- | archaeological_finds/models_finds.py | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index 2c367043c..1e45ca4b3 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -48,6 +48,8 @@ from ishtar_common.utils import convert_coordinates_to_point from ishtar_common import widgets from archaeological_operations.widgets import OAWidget +from archaeological_warehouse.models import Warehouse + from archaeological_finds.forms_treatments import TreatmentSelect, \ TreatmentFormSelection, BaseTreatmentForm, TreatmentModifyForm, \ AdministrativeActTreatmentForm, TreatmentFormFileChoice, \ @@ -349,6 +351,18 @@ class FindSelect(TableSelect): widget=widgets.CheckboxSelectMultiple) datings__period = forms.ChoiceField(label=_(u"Period"), choices=[]) # TODO search by warehouse + container__location = forms.IntegerField( + label=_(u"Warehouse (location)"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-warehouse'), + associated_model=Warehouse), + validators=[valid_id(Warehouse)]) + container__responsible = forms.IntegerField( + label=_(u"Warehouse (responsible)"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-warehouse'), + associated_model=Warehouse), + validators=[valid_id(Warehouse)]) material_types = forms.ChoiceField(label=_(u"Material type"), choices=[]) object_types = forms.ChoiceField(label=_(u"Object type"), choices=[]) preservation_to_considers = forms.ChoiceField( diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 4ece0b286..1d4d6e369 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -571,6 +571,8 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): 'basket': 'basket', 'cached_label': 'cached_label__icontains', 'image__isnull': 'image__isnull', + 'container__location': 'container__location__pk', + 'container__responsible': 'container__responsible__pk', } EXTRA_REQUEST_KEYS.update( dict( |