diff options
Diffstat (limited to 'archaeological_files/forms.py')
| -rw-r--r-- | archaeological_files/forms.py | 37 | 
1 files changed, 27 insertions, 10 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py index 1710a5560..8b5b3d00d 100644 --- a/archaeological_files/forms.py +++ b/archaeological_files/forms.py @@ -609,6 +609,7 @@ JOB_LABELS = {      "days_worked": _("Days"),  } +  class PreventiveFileJobForm(forms.ModelForm):      file_id = forms.IntegerField(widget=forms.HiddenInput) @@ -620,16 +621,15 @@ class PreventiveFileJobForm(forms.ModelForm):          labels = JOB_LABELS -  class PreventiveFileJobBaseFormSet(FileBaseFormset):      model = models.PreventiveFileJob  PreventiveFileJobFormSet = formset_factory(      PreventiveFileJobForm, formset=PreventiveFileJobBaseFormSet, can_delete=True) -PreventiveFileJobFormSet.form_label = _("Jobs") -PreventiveFileJobFormSet.form_admin_name = _("Preventive file - 030 - Jobs") -PreventiveFileJobFormSet.form_slug = "preventive-030-jobs" +PreventiveFileJobFormSet.form_label = _("Post-excavation") +PreventiveFileJobFormSet.form_admin_name = _("Preventive file - 030 - Post-excavation") +PreventiveFileJobFormSet.form_slug = "preventive-030-post-excavation"  PreventiveFileJobFormSet.dynamic_add = True @@ -658,15 +658,32 @@ PreventiveFileGroundJobFormSet.form_admin_name = _(  PreventiveFileGroundJobFormSet.form_slug = "preventive-040-ground-jobs"  PreventiveFileGroundJobFormSet.dynamic_add = True +COST_LABELS = { +    "quantity_by_day_planned": _("Quantity"), +    "days_planned": _("Days / weeks / months"), +    "quantity_by_day_worked": _("Quantity"), +    "days_worked": _("Days / weeks / months"), +} + +INLINE_COST_FIELDS = [ +    "quantity_by_day_planned", "days_planned", "quantity_by_day_worked", "days_worked"] + +COST_WIDGETS = { +    "quantity_by_day_planned": forms.NumberInput(attrs={"class": "w-50 form-planned"}), +    "days_planned": forms.NumberInput(attrs={"class": "w-50 form-planned"}), +    "quantity_by_day_worked": forms.NumberInput(attrs={"class": "w-50 form-worked"}), +    "days_worked": forms.NumberInput(attrs={"class": "w-50 form-worked"}) +} +  class PreventiveFileEquipmentForm(forms.ModelForm):      file_id = forms.IntegerField(widget=forms.HiddenInput)      class Meta:          model = models.PreventiveFileEquipmentCost -        fields = ["equipment_cost"] + INLINE_JOB_FIELDS -        widgets = JOB_WIDGETS -        labels = JOB_LABELS +        fields = ["equipment_cost"] + INLINE_COST_FIELDS +        widgets = COST_WIDGETS +        labels = COST_LABELS  class PreventiveFileEquipmentBaseFormSet(FileBaseFormset): @@ -688,9 +705,9 @@ class PreventiveFileTechnicalServiceForm(forms.ModelForm):      class Meta:          model = models.PreventiveFileTechnicalServiceCost -        fields = ["technical_service_cost"] + INLINE_JOB_FIELDS -        widgets = JOB_WIDGETS -        labels = JOB_LABELS +        fields = ["technical_service_cost"] + INLINE_COST_FIELDS +        widgets = COST_WIDGETS +        labels = COST_LABELS  class PreventiveFileTechnicalServiceBaseFormSet(FileBaseFormset):  | 
