From cd421572fcfb1ffc09fc9f7c6c5e4b90182e027f Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 23 Dec 2016 18:45:31 +0100 Subject: Container: manage indexes by warehouse (refs #3391) --- archaeological_warehouse/forms.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'archaeological_warehouse/forms.py') diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index cd02f12b2..cc21f65f6 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -175,6 +175,16 @@ class ContainerForm(ManageOldType, forms.Form): return new_item +class ContainerModifyForm(ContainerForm): + index = forms.IntegerField(_(u"Index")) + + def __init__(self, *args, **kwargs): + super(ContainerModifyForm, self).__init__(*args, **kwargs) + self.fields.keyOrder.pop(self.fields.keyOrder.index('index')) + self.fields.keyOrder.insert( + self.fields.keyOrder.index("location") + 1, 'index') + ) + class ContainerSelect(TableSelect): location = get_warehouse_field() container_type = forms.ChoiceField(label=_(u"Container type"), choices=[]) -- cgit v1.2.3