mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 23:57:11 +00:00
better validation for survey stations tag/other on an entrance, and bugs fixed
This commit is contained in:
@@ -147,6 +147,7 @@ class CaveForm(ModelForm):
|
||||
self._errors["areacode"] = self.error_class(
|
||||
["An Austrian kataster areacode, i.e. 1623, 1626, 1627, or 1624 is required."]
|
||||
)
|
||||
|
||||
return cleaned_data
|
||||
|
||||
|
||||
@@ -255,10 +256,14 @@ class EntranceForm(ModelForm):
|
||||
)
|
||||
|
||||
def clean(self):
|
||||
# if self.cleaned_data.get("url"): # can remove this as the form does not have a url field any more, which was never used anyway
|
||||
# if self.cleaned_data.get("url").startswith("/"):
|
||||
# self._errors["url"] = self.error_class(["This field cannot start with a /."])
|
||||
return self.cleaned_data
|
||||
cleaned_data = super(EntranceForm, self).clean() # where is this code hidden? How does this work??
|
||||
for station in ["tag_station", "other_station"]:
|
||||
print(f"{station} -- {self.data.get(station)[:4]}")
|
||||
if self.data.get(station)[:5] not in ["1623.", "1626.", "1627.", "1624.", ""]:
|
||||
self._errors[station] = self.error_class(
|
||||
["An Austrian kataster areacode, i.e. 1623, 1626, 1627, or 1624 prefix is required."]
|
||||
)
|
||||
return self.cleaned_data
|
||||
|
||||
|
||||
# # This next line is sufficient to create an entire entry for for the cave fields automatically
|
||||
|
||||
Reference in New Issue
Block a user