tangowithcode / tango_with_django_19

A beginners guide to web programming with Python / Django 1.9
Apache License 2.0
207 stars 188 forks source link

Adding url without "http://" is considered not a URL #32

Open daydream05 opened 8 years ago

daydream05 commented 8 years ago

Even with cleaning the data provided, it's still saved as the original input

def clean(self):
    cleaned_data = self.cleaned_data
    url = cleaned_data.get('url')

    # if url is not empty and doesn't start with 'http://'

    if url and not url.startswith('http://'):
        url = 'http://' + url
        cleaned_data['url'] = url

        return cleaned_data
leifos commented 7 years ago

Thanks - we'll have to look into this..

leonnardo commented 7 years ago

It is working fine for me

leifos commented 7 years ago

Hi Vince, Hi All,

Vince, what browser/os/python/django are you using?

Also, check your code to make sure the indentation is correct - so that the method is within the PageForm.

Leif

On 4 Nov 2016, at 13:41, yamei notifications@github.com wrote:

So do I as leonnardo

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/leifos/tango_with_django_19/issues/32#issuecomment-258433812, or mute the thread https://github.com/notifications/unsubscribe-auth/AB02B0gTmQKGVQJsvo4Z9rc11nTDgIeQks5q6zYQgaJpZM4JqPHV.

NinjaOnRails commented 7 years ago

For me, "https://" is not being accepted. Only "http://" is.

vankhoa011 commented 6 years ago

Hi @leifos , I got the same problem . I'm working on OS X El Capitan. Chrome, Python 3.6.1, Django==1.9