summaryrefslogtreecommitdiff
path: root/archaeological_finds/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-10-03 21:35:15 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-10-03 21:35:15 +0200
commitcabf00c1514b8526b5d926faafb52d9d6e936610 (patch)
treeaa1ca9d23efe215e5e340316141f5919ca7c84fe /archaeological_finds/forms.py
parentc11ef88d8b945a5bfd039eeba8d2fc738c14fb24 (diff)
downloadIshtar-cabf00c1514b8526b5d926faafb52d9d6e936610.tar.bz2
Ishtar-cabf00c1514b8526b5d926faafb52d9d6e936610.zip
Find search: add basket criteria
Diffstat (limited to 'archaeological_finds/forms.py')
-rw-r--r--archaeological_finds/forms.py7
1 files changed, 7 insertions, 0 deletions
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()