summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-08 16:20:30 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:24 +0100
commit939918a683bff6a18cabcd83764e9db8dfd0183a (patch)
tree826b69ce95fe8d3e1f560180d77070fb48eb92d3
parent620d3a62d3a569af9aee6ef5590b779b82e6a8b7 (diff)
downloadIshtar-939918a683bff6a18cabcd83764e9db8dfd0183a.tar.bz2
Ishtar-939918a683bff6a18cabcd83764e9db8dfd0183a.zip
Container form: do not index stationary
-rw-r--r--archaeological_warehouse/forms.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py
index b7724bd3d..c5720390a 100644
--- a/archaeological_warehouse/forms.py
+++ b/archaeological_warehouse/forms.py
@@ -378,6 +378,13 @@ class ContainerModifyForm(ContainerForm):
def clean(self):
# manage unique ID
cleaned_data = super(ContainerModifyForm, self).clean()
+ container_type = cleaned_data.get("container_type", None)
+ try:
+ container_type = models.ContainerType.objects.get(pk=container_type)
+ except models.ContainerType.DoesNotExist:
+ return cleaned_data
+ if container_type.stationary: # no index
+ return cleaned_data
index = cleaned_data.get("index", None)
warehouse = cleaned_data.get("location")
if not index: