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
commit1dcb2fb44584117220b87500188f2539e3a98c14 (patch)
tree826b69ce95fe8d3e1f560180d77070fb48eb92d3
parent42215dd43672f7aef40c9002f6ef7d5975e6c3ac (diff)
downloadIshtar-1dcb2fb44584117220b87500188f2539e3a98c14.tar.bz2
Ishtar-1dcb2fb44584117220b87500188f2539e3a98c14.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: