summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-11-17 13:03:48 +0200
committerPhilip Sargent <philip.sargent@gmail.com>2023-11-17 13:03:48 +0200
commitddf88d53947cb3e248f52659ba8eba8cde27f47b (patch)
tree6cded16f14e28d647d775b2d98f9ff88d2cfbb9a
parent41e64a217c68bfa79c601839c7c67617b3d9ccf1 (diff)
downloadtroggle-ddf88d53947cb3e248f52659ba8eba8cde27f47b.tar.gz
troggle-ddf88d53947cb3e248f52659ba8eba8cde27f47b.tar.bz2
troggle-ddf88d53947cb3e248f52659ba8eba8cde27f47b.zip
make robust against None value
-rw-r--r--core/forms.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/forms.py b/core/forms.py
index 0d03d19..b27a8a8 100644
--- a/core/forms.py
+++ b/core/forms.py
@@ -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