diff options
Diffstat (limited to 'archaeological_finds')
| -rw-r--r-- | archaeological_finds/forms.py | 7 | ||||
| -rw-r--r-- | archaeological_finds/models_finds.py | 4 |
2 files changed, 11 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() diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index bdcb0d0ad..bda25f97c 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -853,6 +853,10 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, pgettext_lazy("key for text search", u"container-ref"), 'container__reference__iexact', ), + 'basket': ( + pgettext_lazy("key for text search", u"basket"), + 'basket__label__exact' + ), } for v in ALT_NAMES.values(): for language_code, language_lbl in settings.LANGUAGES: |
