diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-01-30 12:59:49 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-01-30 13:01:57 +0100 |
commit | 665a009e5980a3eba8237c2eaf3e3fc684f1aea9 (patch) | |
tree | ba7ac8d60dea4568112e5a919589af25a86bc06e | |
parent | c5e80769f5f10a4bd72ec8e59e3c4a6ce7d9029e (diff) | |
download | Ishtar-665a009e5980a3eba8237c2eaf3e3fc684f1aea9.tar.bz2 Ishtar-665a009e5980a3eba8237c2eaf3e3fc684f1aea9.zip |
Find form: remove TAQ/TPQ check (refs #5548)
-rw-r--r-- | CHANGES.md | 3 | ||||
-rw-r--r-- | archaeological_finds/forms.py | 70 |
2 files changed, 4 insertions, 69 deletions
diff --git a/CHANGES.md b/CHANGES.md index 24520376b..acddcd405 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,9 @@ Ishtar changelog - add custom cached_label configuration for each main item - sheet document: better UI for files +### Bug fixes ### +- Find form: remove TAQ/TPQ check + v4.0.42 - 2023-01-25 -------------------- diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index d19cb1e0f..d6e711c48 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -444,7 +444,6 @@ class FindForm(BasicFindForm): associated_models.update( { "get_first_base_find__batch": models.BatchType, - "get_first_base_find__spatial_reference_system": SpatialReferenceSystem, } ) field_order = [ @@ -489,14 +488,6 @@ class FindForm(BasicFindForm): "clutter_short_side", "clutter_height", "dimensions_comment", - "get_first_base_find__x", - "get_first_base_find__estimated_error_x", - "get_first_base_find__y", - "get_first_base_find__estimated_error_y", - "get_first_base_find__z", - "get_first_base_find__estimated_error_z", - "get_first_base_find__spatial_reference_system", - "get_first_base_find__topographic_localisation", "checked_type", "check_date", ] @@ -523,67 +514,8 @@ class FindForm(BasicFindForm): TYPES = BasicFindForm.TYPES + [ FieldType("get_first_base_find__batch", models.BatchType), - FieldType( - "get_first_base_find__spatial_reference_system", SpatialReferenceSystem - ), ] - def clean(self): - self.cleaned_data = super(FindForm, self).clean() - taq = self.cleaned_data.get("get_first_base_find__discovery_date_taq", None) - tpq = self.cleaned_data.get("get_first_base_find__discovery_date", None) - if taq and not tpq: - raise forms.ValidationError( - str( - _( - "Discovery date: if a TAQ date is provided a TPQ date has " - "to be informed. If you have a precise date fill only the " - "TPQ - discovery date field." - ) - ) - ) - elif tpq and taq and taq < tpq: - raise forms.ValidationError( - str(_("Discovery date: TAQ date must be older than TPQ date.")) - ) - - if not get_current_profile().mapping: - return self.cleaned_data - x = self.cleaned_data.get("get_first_base_find__x", None) - y = self.cleaned_data.get("get_first_base_find__y", None) - s = "get_first_base_find__spatial_reference_system" - srs = self.cleaned_data.get(s, None) - if srs: - try: - srs = SpatialReferenceSystem.objects.get(pk=srs) - except SpatialReferenceSystem.DoesNotExist: - srs = None - if x and y and not srs: - raise forms.ValidationError( - _( - "You should at least provide X, Y and the spatial " - "reference system used." - ) - ) - if x and y and srs: - try: - convert_coordinates_to_point( - x, - y, - self.cleaned_data.get("get_first_base_find__z", None), - srs.srid, - ) - except forms.ValidationError as e: - raise forms.ValidationError( - str( - _( - "Coordinates are not relevant for the spatial " - "reference system used: {}." - ) - ).format(e) - ) - return self.cleaned_data - class SimpleFindForm(BasicFindForm): def __init__(self, *args, **kwargs): @@ -737,7 +669,7 @@ class ResultingFindsForm(CustomForm, ManageOldType): ) if q.count(): raise forms.ValidationError( - _("A basket with this label already " "exists.") + _("A basket with this label already exists.") ) return self.cleaned_data |