Opened 7 years ago

Closed 7 years ago

#28572 closed Bug (duplicate)

URLValidator rejects host without tld

Reported by: Jani Tiainen Owned by: Denis.Tarykin
Component: Core (Other) Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Jani Tiainen)

Given valid URL http://myapp:8080/ does not validate as valid url. Happens on 1.8 and 1.11 at least. Note that at if I change localhost in myapp place, URL validates.

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.test import TestCase
from django import forms

class TestForm(forms.Form):
    url = forms.URLField()

class UrlTestCase(TestCase):

    def test_form(self):
        form = TestForm({'url': 'http://myapp:8080/'})

        self.assertTrue(form.is_valid())

Change History (3)

comment:1 by Jani Tiainen, 7 years ago

Description: modified (diff)

comment:2 by Denis.Tarykin, 7 years ago

Owner: changed from nobody to Denis.Tarykin
Status: newassigned

comment:3 by Tim Graham, 7 years ago

Component: FormsCore (Other)
Resolution: duplicate
Status: assignedclosed
Summary: Form URLField validation fails with valid URLURLValidator rejects host without tld

Duplicate of #25418.

Note: See TracTickets for help on using tickets.
Back to Top