2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 08:41:51 +00:00

make robust against None value

This commit is contained in:
Philip Sargent 2023-11-17 13:03:48 +02:00
parent 41e64a217c
commit ddf88d5394

View File

@ -218,8 +218,9 @@ class EntranceForm(ModelForm):
)
def clean(self):
if self.cleaned_data.get("url").startswith("/"):
self._errors["url"] = self.error_class(["This field cannot start with a /."])
if self.cleaned_data.get("url"):
if self.cleaned_data.get("url").startswith("/"):
self._errors["url"] = self.error_class(["This field cannot start with a /."])
return self.cleaned_data