diff options
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r-- | archaeological_operations/forms.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 69f8e3bdb..8c72222cd 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -365,6 +365,17 @@ class RecordRelationsForm(forms.Form): for rel, opes in nc]) return rendered + def clean(self): + cleaned_data = self.cleaned_data + if (cleaned_data.get('relation_type', None) and + not cleaned_data.get('right_record', None)): + raise forms.ValidationError(_(u"You should select an operation.")) + if (not cleaned_data.get('relation_type', None) and + cleaned_data.get('right_record', None)): + raise forms.ValidationError( + _(u"You should select a relation type.")) + return cleaned_data + @classmethod def get_formated_datas(cls, cleaned_datas): result, current, deleted = [], [], [] |