summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-09-01 18:49:14 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-09-01 18:49:14 +0200
commitcaebc92f6e7f0a3e8445d054edd5587c58920c76 (patch)
treecfcbb351671ea74fd6b9ab43ea4b61d3e4fc661a /archaeological_warehouse/forms.py
parentf0901e79cd11ead1d5ac2543ac4affcf23a5f05f (diff)
downloadIshtar-caebc92f6e7f0a3e8445d054edd5587c58920c76.tar.bz2
Ishtar-caebc92f6e7f0a3e8445d054edd5587c58920c76.zip
Non-available types display on old item modification (refs #3179)
Diffstat (limited to 'archaeological_warehouse/forms.py')
-rw-r--r--archaeological_warehouse/forms.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py
index d56df8139..b34be3ab3 100644
--- a/archaeological_warehouse/forms.py
+++ b/archaeological_warehouse/forms.py
@@ -26,7 +26,7 @@ from archaeological_finds.models import TreatmentType, FindBasket
import models
from ishtar_common import widgets
from ishtar_common.forms import name_validator, reverse_lazy, \
- get_form_selection, TableSelect
+ get_form_selection, TableSelect, ManageOldType
from archaeological_finds.forms import FindMultipleFormSelection, \
SelectFindBasketForm
@@ -39,7 +39,7 @@ def get_warehouse_field(label=_(u"Warehouse"), required=True):
validators=[valid_id(models.Warehouse)])
-class WarehouseForm(forms.Form):
+class WarehouseForm(ManageOldType, forms.Form):
name = forms.CharField(label=_(u"Name"), max_length=40,
validators=[name_validator])
warehouse_type = forms.ChoiceField(label=_(u"Warehouse type"),
@@ -71,7 +71,8 @@ class WarehouseForm(forms.Form):
kwargs.pop('limits')
super(WarehouseForm, self).__init__(*args, **kwargs)
self.fields['warehouse_type'].choices = \
- models.WarehouseType.get_types()
+ models.WarehouseType.get_types(
+ initial=self.init_data.get('warehouse_type'))
self.fields['warehouse_type'].help_text = \
models.WarehouseType.get_help()
@@ -88,7 +89,7 @@ class WarehouseForm(forms.Form):
return new_item
-class ContainerForm(forms.Form):
+class ContainerForm(ManageOldType, forms.Form):
form_label = _(u"Container")
reference = forms.CharField(label=_(u"Ref."))
container_type = forms.ChoiceField(label=_(u"Container type"), choices=[])
@@ -106,7 +107,8 @@ class ContainerForm(forms.Form):
kwargs.pop('limits')
super(ContainerForm, self).__init__(*args, **kwargs)
self.fields['container_type'].choices = \
- models.ContainerType.get_types()
+ models.ContainerType.get_types(
+ initial=self.init_data.get('container_type'))
self.fields['container_type'].help_text = \
models.ContainerType.get_help()