diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-04-07 00:28:11 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-04-07 00:28:11 +0200 | 
| commit | 2e690a6ad366f61796b3c6a3fe0526bd89c485a4 (patch) | |
| tree | 854e98488d66f645d05511225b31a6a61e233b7b /archaeological_context_records/forms.py | |
| parent | b923fad188a6f257846a06903cba3e9ad5a2ced9 (diff) | |
| download | Ishtar-2e690a6ad366f61796b3c6a3fe0526bd89c485a4.tar.bz2 Ishtar-2e690a6ad366f61796b3c6a3fe0526bd89c485a4.zip | |
Context records: search within relations
Diffstat (limited to 'archaeological_context_records/forms.py')
| -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 | 
