From 02afd44e7501ffaa2977d1a197d70b87e77ca478 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 25 May 2021 12:05:19 +0200 Subject: Search - Container: search by parent container --- archaeological_warehouse/forms.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'archaeological_warehouse/forms.py') diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index 9bc6de5b0..6638140d6 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -82,7 +82,7 @@ from archaeological_finds.forms import FindMultipleFormSelection, SelectFindBask def get_warehouse_field(label=_("Warehouse"), required=True): - # !FIXME hard_link, reverse_lazy doen't seem to work with formsets + # !FIXME hard_link, reverse_lazy doesn't seem to work with formsets url = "/" + settings.URL_PATH + "autocomplete-warehouse" widget = widgets.JQueryAutoComplete(url, associated_model=models.Warehouse) return forms.IntegerField( @@ -497,6 +497,16 @@ class ContainerSelect(DocumentItemSelect): contain_containers = forms.NullBooleanField(label=_("Contain containers")) empty = forms.NullBooleanField(label=_("Currently empty")) is_stationary = forms.NullBooleanField(label=_("Is stationary")) + parent = forms.IntegerField( + label=_("Parent container"), + widget=widgets.JQueryAutoComplete( + reverse_lazy("autocomplete-container"), + associated_model=models.Container, + dynamic_limit=["location"], + ), + validators=[valid_id(models.Container)], + required=False, + ) archaeological_sites = forms.IntegerField( label=_("Archaeological site (attached to the operation)"), -- cgit v1.2.3