From 214d887c57662f0e7fde50e2fa14be320ed9e69e Mon Sep 17 00:00:00 2001 From: expo Date: Wed, 16 Sep 2015 01:52:45 +0100 Subject: Commit changes made on expo 2015 --- core/forms.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'core/forms.py') diff --git a/core/forms.py b/core/forms.py index 75814ee..9d02066 100644 --- a/core/forms.py +++ b/core/forms.py @@ -29,6 +29,8 @@ 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("/"): + self._errors["url"] = self.error_class(["This field can not start with a /."]) return self.cleaned_data class VersionControlCommentForm(forms.Form): @@ -53,6 +55,10 @@ class EntranceForm(ModelForm): class Meta: model = Entrance exclude = ("cached_primary_slug", "filename",) + def clean(self): + if self.cleaned_data.get("url").startswith("/"): + self._errors["url"] = self.error_class(["This field can not start with a /."]) + return self.cleaned_data -- cgit v1.2.3