diff options
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 |
commit | 1dcb2fb44584117220b87500188f2539e3a98c14 (patch) | |
tree | 826b69ce95fe8d3e1f560180d77070fb48eb92d3 /archaeological_warehouse/forms.py | |
parent | 42215dd43672f7aef40c9002f6ef7d5975e6c3ac (diff) | |
download | Ishtar-1dcb2fb44584117220b87500188f2539e3a98c14.tar.bz2 Ishtar-1dcb2fb44584117220b87500188f2539e3a98c14.zip |
Container form: do not index stationary
Diffstat (limited to 'archaeological_warehouse/forms.py')
-rw-r--r-- | archaeological_warehouse/forms.py | 7 |
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: |