summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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