diff options
Diffstat (limited to 'archaeological_context_records/forms.py')
-rw-r--r-- | archaeological_context_records/forms.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index 522c69deb..91effb397 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -40,7 +40,7 @@ from ishtar_common.forms import FinalForm, FormSet, \ reverse_lazy, get_form_selection, TableSelect, ManageOldType from ishtar_common.forms_common import get_town_field, SourceSelect from archaeological_operations.forms import OperationSelect, ParcelField,\ - RecordRelationsForm as OpeRecordRelationsForm + RecordRelationsForm as OpeRecordRelationsForm, RecordRelationsFormSetBase class OperationFormSelection(forms.Form): @@ -77,7 +77,7 @@ 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/public domain)")) - relation_types = forms.MultipleChoiceField( + cr_relation_types = forms.MultipleChoiceField( label=_(u"Search within relations"), choices=[], widget=forms.CheckboxSelectMultiple) @@ -87,8 +87,8 @@ 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) + self.fields['cr_relation_types'].choices = \ + models.RelationType.get_types(empty_first=False) self.fields['ope_relation_types'].choices = OpeRelationType.get_types( empty_first=False) @@ -98,9 +98,9 @@ class RecordSelect(TableSelect): ids.append('parcel_0') ids.append('parcel_1') ids.append('parcel_2') - ids.pop(ids.index('relation_types')) - for idx, c in enumerate(self.fields['relation_types'].choices): - ids.append('relation_types_{}'.format(idx)) + ids.pop(ids.index('cr_relation_types')) + for idx, c in enumerate(self.fields['cr_relation_types'].choices): + ids.append('cr_relation_types_{}'.format(idx)) ids.pop(ids.index('ope_relation_types')) for idx, c in enumerate(self.fields['ope_relation_types'].choices): ids.append('ope_relation_types_{}'.format(idx)) @@ -302,7 +302,8 @@ class RecordRelationsForm(OpeRecordRelationsForm): if crs: self.fields['right_record'].choices = [('', '-' * 2)] + crs -RecordRelationsFormSet = formset_factory(RecordRelationsForm, can_delete=True) +RecordRelationsFormSet = formset_factory( + RecordRelationsForm, can_delete=True, formset=RecordRelationsFormSetBase) RecordRelationsFormSet.form_label = _(u"Relations") |