diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-09-24 16:02:27 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:20 +0100 |
commit | a21d0649b0e0122fdee368307241c6f938a85822 (patch) | |
tree | 672a8a6e672b978962e9878fd046e9d313875ddd /archaeological_warehouse/forms.py | |
parent | eb039681c8ac7fbab9905b1a3dedc355523ee8ba (diff) | |
download | Ishtar-a21d0649b0e0122fdee368307241c6f938a85822.tar.bz2 Ishtar-a21d0649b0e0122fdee368307241c6f938a85822.zip |
Container: fix parent field on form - prevent recursion on parent location fix
Diffstat (limited to 'archaeological_warehouse/forms.py')
-rw-r--r-- | archaeological_warehouse/forms.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index 170edce1f..12e9f4949 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -308,6 +308,7 @@ class ContainerForm(CustomForm, ManageOldType, forms.Form): raise forms.ValidationError( _("The parent container is not attached to the same " "warehouse.")) + return self.cleaned_data["parent"] def clean(self): cleaned_data = self.cleaned_data @@ -343,10 +344,14 @@ class ContainerModifyForm(ContainerForm): super(ContainerModifyForm, self).__init__(*args, **kwargs) fields = OrderedDict() idx = self.fields.pop('index') + reordered = False for key, value in self.fields.items(): fields[key] = value if key == 'container_type': fields['index'] = idx + reordered = True + if not reordered: + fields['index'] = idx self.fields = fields def clean(self): |