diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-03-04 15:20:35 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-03-04 15:20:35 +0100 |
commit | e91a151d549bfc06cb27772e717b80412a39ff61 (patch) | |
tree | ffe15f635ae08c2d17c248bc50cafaa90858994a /archaeological_operations/forms.py | |
parent | 0a1924807b971820ca53442bc3ea3ad3ac4ec4cd (diff) | |
download | Ishtar-e91a151d549bfc06cb27772e717b80412a39ff61.tar.bz2 Ishtar-e91a151d549bfc06cb27772e717b80412a39ff61.zip |
Operations: check relations form
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 = [], [], [] |