From d7c6676c492e9dab146e346517fc68ad9ebd42db Mon Sep 17 00:00:00 2001 From: expoonserver Date: Wed, 25 Oct 2017 03:49:03 +0100 Subject: [PATCH] Test whether url is not 'None' before applying 'startswith' test in forms.py entering new caves, otherwise it barfs. --- core/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/forms.py b/core/forms.py index 9d02066..4530b0e 100644 --- a/core/forms.py +++ b/core/forms.py @@ -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