diff options
Diffstat (limited to 'archaeological_operations')
-rw-r--r-- | archaeological_operations/forms.py | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 2104938c2..97a479505 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -594,17 +594,19 @@ class OperationSelect(GeoItemSelect): SITE_KEYS = {"archaeological_sites": None} def __init__(self, *args, **kwargs): - super(OperationSelect, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) profile = get_current_profile() if not profile.warehouse: - self.fields.pop('documentation_deadline_before') - self.fields.pop('documentation_deadline_after') - self.fields.pop('documentation_received') - self.fields.pop('finds_deadline_before') - self.fields.pop('finds_deadline_after') - self.fields.pop('finds_received') + self._remove_fields(( + 'documentation_deadline_before', + 'documentation_deadline_after', + 'documentation_received', + 'finds_deadline_before', + 'finds_deadline_after', + 'finds_received', + )) if not profile.underwater: - self.fields.pop('drassm_code') + self._remove_fields(("drassm_code",)) if settings.ISHTAR_DPTS: k = 'towns__numero_insee__startswith' self.fields[k].choices = [ @@ -865,7 +867,7 @@ class OperationFormGeneral(CustomForm, ManageOldType): for key in self.WAREHOUSE_FIELDS: self.remove_field(key) if not profile.underwater: - self.fields.pop('drassm_code') + self._remove_fields(("drassm_code",)) if 'collaborator' in self.fields: self.fields['collaborator'].widget.attrs['full-width'] = True if towns and towns != -1: @@ -939,7 +941,7 @@ class OperationFormModifGeneral(OperationFormGeneral): def __init__(self, *args, **kwargs): super(OperationFormModifGeneral, self).__init__(*args, **kwargs) if not get_current_profile().files: - self.fields.pop('associated_file') + self._remove_fields(("associated_file",)) fields = OrderedDict() for idx, field in enumerate(list(self.fields.items())): @@ -1269,15 +1271,17 @@ class SiteSelect(GeoItemSelect): ] + GeoItemSelect.TYPES def __init__(self, *args, **kwargs): - super(SiteSelect, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if not get_current_profile().underwater: - self.fields.pop('shipwreck_name') - self.fields.pop('oceanographic_service_localisation') - self.fields.pop('shipwreck_code') - self.fields.pop('sinking_date') - self.fields.pop('discovery_area') - self.fields.pop('affmar_number') - self.fields.pop('drassm_number') + self._remove_fields(( + 'shipwreck_name', + 'oceanographic_service_localisation', + 'shipwreck_code', + 'sinking_date', + 'discovery_area', + 'affmar_number', + 'drassm_number', + )) class SiteFormSelection(LockForm, CustomFormSearch): |