diff options
Diffstat (limited to 'archaeological_operations/forms.py')
| -rw-r--r-- | archaeological_operations/forms.py | 22 | 
1 files changed, 22 insertions, 0 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 3d679d555..8c3650c21 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -335,6 +335,28 @@ ParcelFormSet = formset_factory(ParcelForm, can_delete=True,                                  formset=ParcelFormSet)  ParcelFormSet.form_label = _(u"Parcels") + +class RecordRelationsForm(forms.Form): +    base_model = 'right_relation' +    associated_models = {'right_record': models.Operation, +                         'relation_type': models.RelationType} +    relation_type = forms.ChoiceField(label=_(u"Relation type"), +                                      choices=[], required=False) +    right_record = forms.IntegerField( +        label=_(u"Operation"), +        widget=widgets.JQueryAutoComplete( +            reverse_lazy('autocomplete-operation'), +            associated_model=models.Operation), +        validators=[valid_id(models.Operation)], required=False) + +    def __init__(self, *args, **kwargs): +        super(RecordRelationsForm, self).__init__(*args, **kwargs) +        self.fields['relation_type'].choices = \ +            models.RelationType.get_types() + +RecordRelationsFormSet = formset_factory(RecordRelationsForm, can_delete=True) +RecordRelationsFormSet.form_label = _(u"Relations") +  SRA_AGENT, created = PersonType.objects.get_or_create(txt_idx='sra_agent')  HEAD_SCIENTIST, created = PersonType.objects.get_or_create(      txt_idx='head_scientist')  | 
