diff options
| -rw-r--r-- | archaeological_context_records/forms.py | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index e9b5994eb..5160c1c51 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -59,6 +59,9 @@ class RecordSelect(TableSelect):      datings__period = forms.ChoiceField(label=_(u"Period"), choices=[])      unit = forms.ChoiceField(label=_(u"Unit type"), choices=[])      parcel = ParcelField(label=_(u"Parcel (section/number)")) +    relation_types = forms.MultipleChoiceField( +        label=_(u"Search within relations"), choices=[], +        widget=forms.CheckboxSelectMultiple)      def __init__(self, *args, **kwargs):          super(RecordSelect, self).__init__(*args, **kwargs) @@ -66,12 +69,17 @@ class RecordSelect(TableSelect):          self.fields['datings__period'].help_text = Period.get_help()          self.fields['unit'].choices = models.Unit.get_types()          self.fields['unit'].help_text = models.Unit.get_help() +        self.fields['relation_types'].choices = models.RelationType.get_types( +            empty_first=False)      def get_input_ids(self):          ids = super(RecordSelect, self).get_input_ids()          ids.pop(ids.index('parcel'))          ids.append('parcel_0')          ids.append('parcel_1') +        ids.pop(ids.index('relation_types')) +        for idx, c in enumerate(self.fields['relation_types'].choices): +            ids.append('relation_types_{}'.format(idx))          return ids | 
