summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/forms.py70
1 files changed, 1 insertions, 69 deletions
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