MCPcopy
hub / github.com/django/django / clean_url

Method clean_url

django/contrib/flatpages/forms.py:43–55  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

41 )
42
43 def clean_url(self):
44 url = self.cleaned_data["url"]
45 if not url.startswith("/"):
46 raise ValidationError(
47 gettext("URL is missing a leading slash."),
48 code="missing_leading_slash",
49 )
50 if self._trailing_slash_required() and not url.endswith("/"):
51 raise ValidationError(
52 gettext("URL is missing a trailing slash."),
53 code="missing_trailing_slash",
54 )
55 return url
56
57 def clean(self):
58 url = self.cleaned_data.get("url")

Callers

nothing calls this directly

Calls 3

ValidationErrorClass · 0.90
gettextFunction · 0.90

Tested by

no test coverage detected