I had this issue too. My problem was that a pop up constantly showed when entering a url string missing http://
, saying "Please enter a URL". So the clean()
call never had a chance to happen.
I think this is because the default widget for a URLfield
in a form performs a check. By doing the following, the clean() code got a chance to happen and add an eventual missing "http://"
from django.forms.widgets import TextInput
...
url = forms.URLField(max_length=200,
help_text="Please enter the URL of the page.",
initial="http://",
widget=TextInput)
The default is widget=UrlInput