From 939918a683bff6a18cabcd83764e9db8dfd0183a Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 8 Feb 2021 16:20:30 +0100 Subject: Container form: do not index stationary --- archaeological_warehouse/forms.py | 7 +++++++ 1 file changed, 7 insertions(+) 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: -- cgit v1.2.3