diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-09-02 10:10:59 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-09-02 10:10:59 +0200 |
commit | 151e42654a4bcfcff408c7799db199c71e81b5c5 (patch) | |
tree | 02786db1039902c7cc75f76aa7159829299970ac /archaeological_warehouse/forms.py | |
parent | 661218e0acd24fc3bca76229b61d0cb91a54be1c (diff) | |
parent | 5eb8667794636e379a8c324da46c617ad365747a (diff) | |
download | Ishtar-151e42654a4bcfcff408c7799db199c71e81b5c5.tar.bz2 Ishtar-151e42654a4bcfcff408c7799db199c71e81b5c5.zip |
Merge branch 'master' into v0.9
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() |