URL validation without schemes

For the URLField it will assume http:// if one isn’t supplied. I want my field to work like this.

But the URLValidator raises an error.

Shouldn’t the Field validator and to_python methods match?

It looks like I will have to create my own validator that is more relaxed. Unless someone knows a better way to handle this?

No, I don’t think they should - nor do they need to.

Those functions (to_python and a field validator) provide two different functions with two different sets of requirements.

Note that one of the uses of to_python is in the clean methods of form input. You may want to accept an input of an “incomplete” url from a form as valid, to subsequently add the scheme within your code.

You can then clean-up that field before saving it to the database - which is where the Validator is used.