diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-08-03 17:53:55 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-10-25 12:06:02 +0200 |
commit | bfb1078d8a00d344d9ed65057516e792141ae3f9 (patch) | |
tree | 6e6223fd9f8033d727ae2c19bf700c4dd6afb0b6 /archaeological_files/forms.py | |
parent | 718b7a8a7109278003cf487a4a9069fe5314cce3 (diff) | |
download | Ishtar-bfb1078d8a00d344d9ed65057516e792141ae3f9.tar.bz2 Ishtar-bfb1078d8a00d344d9ed65057516e792141ae3f9.zip |
Preventive file: add fields - remove dynamic add (too buggy for now)
Diffstat (limited to 'archaeological_files/forms.py')
-rw-r--r-- | archaeological_files/forms.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py index 77d19ce2f..46e0aae9c 100644 --- a/archaeological_files/forms.py +++ b/archaeological_files/forms.py @@ -518,6 +518,7 @@ class FileFormPreventiveDetail(forms.ModelForm, CustomForm, ManageOldType): HEADERS = { "start_date": FormHeader(_("Dates")), "total_developed_surface": FormHeader(_("Surfaces")), + "type_of_agreement": FormHeader(_("Archaeological royalties")), } class Meta: @@ -529,6 +530,8 @@ class FileFormPreventiveDetail(forms.ModelForm, CustomForm, ManageOldType): "ground_end_date", "study_period", "execution_report_date", + "type_of_agreement", + "operation_type_for_royalties", "total_developed_surface", "total_surface", "linear_meter", @@ -594,6 +597,10 @@ class FileFormPreventiveDetail(forms.ModelForm, CustomForm, ManageOldType): if kwargs.get("user", None): self.user = kwargs.pop("user") super(FileFormPreventiveDetail, self).__init__(*args, **kwargs) + if not models.AgreementType.objects.count(): + self.fields.pop("type_of_agreement") + if not models.OperationTypeForRoyalties.objects.count(): + self.fields.pop("operation_type_for_royalties") class FileBaseFormset(forms.BaseModelFormSet): @@ -704,7 +711,8 @@ PreventiveFileJobFormSet = formset_factory( 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 +PreventiveFileJobFormSet.extra = 2 +#PreventiveFileJobFormSet.dynamic_add = True class PreventiveFileGroundJobForm(PreventiveFileGenJobForm): @@ -723,13 +731,14 @@ PreventiveFileGroundJobFormSet = formset_factory( PreventiveFileGroundJobForm, formset=PreventiveFileGroundJobBaseFormSet, can_delete=True, + extra=2 ) PreventiveFileGroundJobFormSet.form_label = _("Ground jobs") PreventiveFileGroundJobFormSet.form_admin_name = _( "Preventive file - 040 - Ground jobs" ) PreventiveFileGroundJobFormSet.form_slug = "preventive-040-ground-jobs" -PreventiveFileGroundJobFormSet.dynamic_add = True +#PreventiveFileGroundJobFormSet.dynamic_add = True COST_LABELS = { "quantity_by_day_planned": _("Quantity"), |