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 | e37a1a98fabc5b1c85ce1b20e50e81575ee53f05 (patch) | |
tree | 854e98488d66f645d05511225b31a6a61e233b7b /archaeological_context_records/forms.py | |
parent | ed962f3f09f7882e25a2d73d4c7cb164d4a209ca (diff) | |
download | Ishtar-e37a1a98fabc5b1c85ce1b20e50e81575ee53f05.tar.bz2 Ishtar-e37a1a98fabc5b1c85ce1b20e50e81575ee53f05.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 |