From 4001e44945a3ed6731a740ee84d0f52ba7719a63 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 25 Jan 2021 15:12:35 +0100 Subject: Container: fix container modification when no parent is defined --- archaeological_warehouse/forms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'archaeological_warehouse') diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index b5a9b4391..b7724bd3d 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -338,7 +338,8 @@ class ContainerForm(CustomForm, ManageOldType, forms.Form): if q.count(): raise forms.ValidationError(_("This reference already exists for " "this warehouse.")) - if pk and pk == int(cleaned_data.get("parent")): + if pk and cleaned_data.get("parent", None) and pk == int( + cleaned_data.get("parent")): raise forms.ValidationError(_("A container cannot be a parent of " "himself.")) return cleaned_data -- cgit v1.2.3