From 7c555a286e07f4fc5d4676d461ccd5f242dee676 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 13 Jun 2017 20:18:40 +0200 Subject: Context record wizard: fix related context record association on creation --- archaeological_operations/forms.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'archaeological_operations/forms.py') diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 314e184e2..058e637f4 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -416,7 +416,9 @@ class RecordRelationsForm(ManageOldType, forms.Form): cleaned_data.get('right_record', None)): raise forms.ValidationError( _(u"You should select a relation type.")) - if str(cleaned_data.get('right_record')) == str(self.left_record.pk): + if self.left_record and \ + str(cleaned_data.get('right_record')) == str( + self.left_record.pk): raise forms.ValidationError( _(u"An operation cannot be related to herself.")) return cleaned_data -- cgit v1.2.3