mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 14:51:08 -05:00
fix error handling
This commit is contained in:
@@ -169,8 +169,8 @@ class ParkForm(forms.ModelForm):
|
|||||||
|
|
||||||
# Convert to string to preserve exact decimal places
|
# Convert to string to preserve exact decimal places
|
||||||
return str(latitude)
|
return str(latitude)
|
||||||
except (InvalidOperation, TypeError):
|
except (InvalidOperation, TypeError) as e:
|
||||||
raise forms.ValidationError("Invalid latitude value.")
|
raise forms.ValidationError("Invalid latitude value.") from e
|
||||||
return latitude
|
return latitude
|
||||||
|
|
||||||
def clean_longitude(self):
|
def clean_longitude(self):
|
||||||
@@ -188,8 +188,8 @@ class ParkForm(forms.ModelForm):
|
|||||||
|
|
||||||
# Convert to string to preserve exact decimal places
|
# Convert to string to preserve exact decimal places
|
||||||
return str(longitude)
|
return str(longitude)
|
||||||
except (InvalidOperation, TypeError):
|
except (InvalidOperation, TypeError) as e:
|
||||||
raise forms.ValidationError("Invalid longitude value.")
|
raise forms.ValidationError("Invalid longitude value.") from e
|
||||||
return longitude
|
return longitude
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
|
|||||||
Reference in New Issue
Block a user