From cabf00c1514b8526b5d926faafb52d9d6e936610 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 3 Oct 2018 21:35:15 +0200 Subject: Find search: add basket criteria --- archaeological_finds/forms.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'archaeological_finds/forms.py') diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index 358b12477..fbcc32013 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -453,6 +453,7 @@ class FindSelect(CustomForm, TableSelect): reverse_lazy('autocomplete-contextrecord'), associated_model=ContextRecord), validators=[valid_id(ContextRecord)]) + basket = forms.ChoiceField(label=_(u"Basket"), choices=[]) ope_relation_types = forms.ChoiceField( label=_(u"Search within related operations"), choices=[]) cr_relation_types = forms.ChoiceField( @@ -497,6 +498,12 @@ class FindSelect(CustomForm, TableSelect): if 'cr_relation_types' in self.fields: self.fields['cr_relation_types'].choices = CRRelationType.get_types( ) + if 'basket' in self.fields: + self.fields['basket'].choices = [('', '--')] + if self.current_user: + self.fields['basket'].choices += [ + (b.pk, b.label) for b in models.FindBasket.objects.filter( + user=self.current_user).all()] def get_input_ids(self): ids = super(FindSelect, self).get_input_ids() -- cgit v1.2.3