summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-01-25 15:12:35 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:24 +0100
commit44cd3cad8b85a9e7477797d074a5aebc1ad40607 (patch)
treeb30300d7487f45632a9541f8948b014f78c0f21a
parent726575912e0c579048c1211219e2dbcf8f40a861 (diff)
downloadIshtar-44cd3cad8b85a9e7477797d074a5aebc1ad40607.tar.bz2
Ishtar-44cd3cad8b85a9e7477797d074a5aebc1ad40607.zip
Container: fix container modification when no parent is defined
-rw-r--r--archaeological_warehouse/forms.py3
1 files changed, 2 insertions, 1 deletions
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