diff options
| -rw-r--r-- | archaeological_files/forms.py | 15 | ||||
| -rw-r--r-- | archaeological_finds/forms_treatments.py | 27 | 
2 files changed, 19 insertions, 23 deletions
| diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py index afb62ae4f..5085455d8 100644 --- a/archaeological_files/forms.py +++ b/archaeological_files/forms.py @@ -35,7 +35,7 @@ from archaeological_operations.models import ActType, AdministrativeAct, \      OperationType  import models  from ishtar_common.forms import FinalForm, get_now, reverse_lazy, TableSelect, \ -    ManageOldType +    ManageOldType, CustomForm, FieldType  from ishtar_common.forms_common import get_town_field  from archaeological_operations.forms import AdministrativeActOpeForm, \      AdministrativeActOpeFormSelection, \ @@ -528,15 +528,14 @@ class AdministrativeActFileModifyFormSelection(  class AdministrativeActFileForm(AdministrativeActOpeForm): +    form_admin_name = _(u"Archaeological files - Administrative act - General") +    form_slug = "file-adminact-general"      act_type = forms.ChoiceField(label=_(u"Act type"), choices=[]) -    def __init__(self, *args, **kwargs): -        super(AdministrativeActFileForm, self).__init__(*args, **kwargs) -        self.fields['act_type'].choices = ActType.get_types( -            initial=self.init_data.get('act_type'), -            dct={'intented_to': 'F'}) -        self.fields['act_type'].help_text = ActType.get_help( -            dct={'intented_to': 'F'}) +    TYPES = [ +        FieldType('act_type', ActType, +                  extra_args={"dct": {'intented_to': 'F'}}), +    ]  class AdministrativeActFileModifForm(AdministrativeActModifForm, diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py index 93a98bf1a..4e5994ca9 100644 --- a/archaeological_finds/forms_treatments.py +++ b/archaeological_finds/forms_treatments.py @@ -380,15 +380,14 @@ class AdministrativeActTreatmentFormSelection(  class AdministrativeActTreatmentForm(AdministrativeActOpeForm): +    form_admin_name = _(u"Treatment - Administrative act - General") +    form_slug = "treatment-adminact-general"      act_type = forms.ChoiceField(label=_(u"Act type"), choices=[]) -    def __init__(self, *args, **kwargs): -        super(AdministrativeActTreatmentForm, self).__init__(*args, **kwargs) -        self.fields['act_type'].choices = ActType.get_types( -            initial=self.init_data.get('act_type'), -            dct={'intented_to': 'T'}) -        self.fields['act_type'].help_text = ActType.get_help( -            dct={'intented_to': 'T'}) +    TYPES = [ +        FieldType('act_type', ActType, +                  extra_args={"dct": {'intented_to': 'T'}}), +    ]  class AdministrativeActTreatmentModifForm( @@ -637,16 +636,14 @@ class AdministrativeActTreatmentFileFormSelection(  class AdministrativeActTreatmentFileForm(AdministrativeActOpeForm): +    form_admin_name = _(u"Treatment request - Administrative act - General") +    form_slug = "treatmentfile-adminact-general"      act_type = forms.ChoiceField(label=_(u"Act type"), choices=[]) -    def __init__(self, *args, **kwargs): -        super(AdministrativeActTreatmentFileForm, self).__init__(*args, -                                                                 **kwargs) -        self.fields['act_type'].choices = ActType.get_types( -            initial=self.init_data.get('act_type'), -            dct={'intented_to': 'TF'}) -        self.fields['act_type'].help_text = ActType.get_help( -            dct={'intented_to': 'TF'}) +    TYPES = [ +        FieldType('act_type', ActType, +                  extra_args={"dct": {'intented_to': 'TF'}}), +    ]  class AdministrativeActTreatmentFileModifForm( | 
