diff options
Diffstat (limited to 'archaeological_warehouse/forms.py')
| -rw-r--r-- | archaeological_warehouse/forms.py | 12 | 
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() | 
