diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-25 12:06:36 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:25 +0100 |
commit | 70a69dcea0bb92ef346c51da42122bf0f883dac9 (patch) | |
tree | 52779d05a64ead1ca6a9882cda58f9dd767a50cc | |
parent | 3dbeac686f1519ed8b9a961202b7ec2264591af9 (diff) | |
download | Ishtar-70a69dcea0bb92ef346c51da42122bf0f883dac9.tar.bz2 Ishtar-70a69dcea0bb92ef346c51da42122bf0f883dac9.zip |
Generic extra forms modals for all pages (refs #5052)
-rw-r--r-- | archaeological_files/forms.py | 1 | ||||
-rw-r--r-- | archaeological_files_pdl/forms.py | 3 | ||||
-rw-r--r-- | archaeological_finds/forms.py | 2 | ||||
-rw-r--r-- | archaeological_finds/forms_treatments.py | 2 | ||||
-rw-r--r-- | archaeological_operations/forms.py | 5 | ||||
-rw-r--r-- | archaeological_warehouse/forms.py | 2 | ||||
-rw-r--r-- | ishtar_common/views.py | 5 | ||||
-rw-r--r-- | ishtar_common/wizards.py | 8 |
8 files changed, 10 insertions, 18 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py index 0108a8375..631407ac0 100644 --- a/archaeological_files/forms.py +++ b/archaeological_files/forms.py @@ -358,7 +358,6 @@ class FileFormResearch(CustomForm, ManageOldType, forms.Form): form_label = _("Research archaeology") form_admin_name = _("Archaeological file - 045 - Research - General") form_slug = "file-045-research-general" - extra_form_modals = ["person", "organization"] base_model = 'department' associated_models = {'scientist': Person, 'requested_operation_type': OperationType, diff --git a/archaeological_files_pdl/forms.py b/archaeological_files_pdl/forms.py index 54cc51dde..8f3847ced 100644 --- a/archaeological_files_pdl/forms.py +++ b/archaeological_files_pdl/forms.py @@ -250,7 +250,6 @@ class FileFormGeneralContractor(CustomForm, ManageOldType): form_label = _("General contractor") form_admin_name = _("Archaeological file - 030 - General contractor") form_slug = "file-030-generalcontractor" - extra_form_modals = ["person", "organization"] associated_models = {'general_contractor': models.Person, 'corporation_general_contractor': models.Organization} @@ -315,7 +314,6 @@ class FileFormPlanningService(CustomForm, IshtarForm): form_label = _("Planning service") form_admin_name = _("Archaeological file - 040 - Planning service") form_slug = "file-040-planningservice" - extra_form_modals = ["person", "organization"] associated_models = {'responsible_town_planning_service': models.Person, 'planning_service': models.Organization} @@ -382,7 +380,6 @@ class FileFormInstruction(CustomForm, IshtarForm): form_label = _("Instruction") form_admin_name = _("Archaeological file - 050 - Instruction") form_slug = "file-050-instruction" - extra_form_modals = ["person", "organization"] associated_models = {'in_charge': models.Person, 'related_file': models.File} in_charge = forms.IntegerField( diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index dad663624..099623f33 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -296,7 +296,6 @@ class FindForm(BasicFindForm): file_upload = True form_label = _("Find") form_admin_name = _("Find - 020 - General") - extra_form_modals = ["warehouse"] form_slug = "find-020-general" base_models = ['get_first_base_find'] + BasicFindForm.base_models associated_models = BasicFindForm.associated_models.copy() @@ -1363,7 +1362,6 @@ class FindFormSelectionWarehouseModule(FindFormSelection): gallery=True, map=True, source_full=reverse_lazy('get-find-full')), validators=[valid_id(models.Find)]) - extra_form_modals = ["container", "warehouse"] class FindFormMultiSelectionWarehouseModule(FindFormMultiSelection): diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py index 7fc0d877c..6c22b30ee 100644 --- a/archaeological_finds/forms_treatments.py +++ b/archaeological_finds/forms_treatments.py @@ -127,7 +127,6 @@ class BaseTreatmentForm(CustomForm, ManageOldType): form_admin_name = _("Treatment - 020 - General") form_slug = "treatment-020-general" base_models = ['treatment_type'] - extra_form_modals = ["container", "warehouse", "organization", "person"] associated_models = {'treatment_type': models.TreatmentType, 'person': Person, 'scientific_monitoring_manager': Person, @@ -763,7 +762,6 @@ class TreatmentFileForm(CustomForm, ManageOldType): 'applicant': Person, 'applicant_organisation': Organization, 'associated_basket': models.FindBasket } - extra_form_modals = ["person", "organization"] need_user_for_initialization = True name = forms.CharField(label=_("Name"), diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 2d462c252..c9d95c506 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -610,7 +610,6 @@ class OperationFormSelection(LockForm, CustomFormSearch): SEARCH_AND_SELECT = True form_label = _("Operation search") associated_models = {'pk': models.Operation} - extra_form_modals = ["person", "organization"] currents = {'pk': models.Operation} pk = forms.IntegerField( label="", required=False, @@ -624,7 +623,6 @@ class OperationFormSelection(LockForm, CustomFormSearch): class OperationFormMultiSelection(LockForm, MultiSearchForm): form_label = _("Operation search") associated_models = {'pks': models.Operation} - extra_form_modals = ["person", "organization"] pk_key = 'pks' pk = forms.CharField( label="", required=False, @@ -765,7 +763,6 @@ class OperationFormGeneral(CustomForm, ManageOldType): form_label = _("General") form_admin_name = _("Operation - 010 - General") form_slug = "operation-010-general" - extra_form_modals = ["person", "organization"] file_upload = True associated_models = { @@ -1030,7 +1027,6 @@ class CourtOrderedSeizureForm(CustomForm, IshtarForm): form_label = _("Court-ordered seizure") form_admin_name = _("Operation - 015 - Court-ordered seizure") form_slug = "operation-015-court-ordered-seizure" - extra_form_modals = ["person", "organization"] associated_models = { 'protagonist': Person, 'applicant_authority': Organization, @@ -1689,7 +1685,6 @@ class AdministrativeActOpeFormSelection(IshtarForm): class AdministrativeActForm(CustomForm, ManageOldType): form_label = _("General") - extra_form_modals = ["person", "organization"] associated_models = {'act_type': models.ActType, 'signatory': Person} act_type = forms.ChoiceField(label=_("Act type"), choices=[]) diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index 3b10fb608..06a3ca493 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -145,7 +145,6 @@ class WarehouseForm(CustomForm, ManageOldType, forms.Form): form_label = _("Warehouse") form_admin_name = _("Warehouse - 010 - General") form_slug = "warehouse-010-general" - extra_form_modals = ["organization", "person"] associated_models = { 'warehouse_type': models.WarehouseType, 'person_in_charge': Person, @@ -262,7 +261,6 @@ class ContainerForm(CustomForm, ManageOldType, forms.Form): form_admin_name = _("Container - 010 - General") form_slug = "container-010-general" file_upload = True - extra_form_modals = ["warehouse", "organization", "person", "container"] associated_models = {'container_type': models.ContainerType, 'location': models.Warehouse, 'responsibility': models.Warehouse, diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 45a7530c7..cb1af7c5d 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -119,7 +119,10 @@ def index(request): """ Main page """ - dct = {'warnings': []} + dct = { + 'warnings': [], + "extra_form_modals": wizards.EXTRA_FORM_MODALS + } if settings.PROJECT_SLUG == 'default': dct['warnings'].append(_( "PROJECT_SLUG is set to \"default\". Change it in your " diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index b23069d36..e72ed2cb1 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -89,6 +89,9 @@ def filter_no_fields_form(form, other_check=None): return func +EXTRA_FORM_MODALS = ["container", "warehouse", "person", "organization"] + + class IshtarWizard(NamedUrlWizardView): def get_form_kwargs(self, step=None): kwargs = super(IshtarWizard, self).get_form_kwargs(step) @@ -99,8 +102,9 @@ class IshtarWizard(NamedUrlWizardView): def get_context_data(self, form, **kwargs): context = super(IshtarWizard, self).get_context_data(form, **kwargs) - if hasattr(form, "extra_form_modals"): - context["extra_form_modals"] = form.extra_form_modals + + context["extra_form_modals"] = form.extra_form_modals \ + if hasattr(form, "extra_form_modals") else EXTRA_FORM_MODALS open_item_id = self.request.GET.get('open_item', None) if open_item_id and self.model and \ |