From 74b11851bb9a3be86b8b67277c9cd6d5be7ff507 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 31 May 2018 19:30:38 +0200 Subject: Wizard: prevent error on form initialization when no context record is provided (should not happen but...) --- archaeological_finds/forms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index def29a327..a01bd45a6 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -267,7 +267,8 @@ class FindForm(CustomForm, ManageOldType): def __init__(self, *args, **kwargs): context_record = kwargs.pop('context_record') super(FindForm, self).__init__(*args, **kwargs) - if not context_record.operation.operation_type.judiciary: + if not context_record or \ + not context_record.operation.operation_type.judiciary: self.fields.pop('seal_number') self.fields['checked'].choices = models.CHECK_CHOICES -- cgit v1.2.3