2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-01-20 01:42:30 +00:00

Test whether url is not 'None' before applying 'startswith' test in

forms.py entering new caves, otherwise it barfs.
This commit is contained in:
expoonserver 2017-10-25 03:49:03 +01:00
parent d7b2ddefce
commit 86b1e6e577

View File

@ -29,7 +29,7 @@ class CaveForm(ModelForm):
self._errors["official_name"] = self.error_class(["This field is required when there is a kataster number."])
if self.cleaned_data.get("area") == []:
self._errors["area"] = self.error_class(["This field is required."])
if self.cleaned_data.get("url").startswith("/"):
if self.cleaned_data.get("url") and self.cleaned_data.get("url").startswith("/"):
self._errors["url"] = self.error_class(["This field can not start with a /."])
return self.cleaned_data