I am currently using an URLField to store an AWS S3 URL for one of my
models (`s3://bucket/prefix`).
URLField uses urllib to validate the URL and finds this URL consistent;
but the URL validator used by Django Admin is different and demands that
the scheme of the URL must be one of `schemes = ['http', 'https', 'ftp',
'ftps']`.
The effect is that you can't modify an instance on Django Admin because it
blocks saving.
The bug is in Django 2.2 and 3.0.
--
Ticket URL: <https://code.djangoproject.com/ticket/31063>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* component: contrib.admin => Core (Other)
* version: 2.2 => master
* resolution: => duplicate
Comment:
In both cases Django uses the same validator
`django.core.validators.URLValidator`. Note that `Model.save()` doesn't
validate fields (see
[https://docs.djangoproject.com/en/3.0/ref/models/instances/#what-happens-
when-you-save documentation]). You can subclass `URLField` and add `s3` to
the list of accepted schemas, e.g.
{{{#!python
class MyURLField(URLField):
default_validators = [validators.URLValidator(schemes=['s3', 'http',
'https', 'ftp', 'ftps'])]
}}}
Solving #25594 should make it easier.
Duplicate of #26418.
--
Ticket URL: <https://code.djangoproject.com/ticket/31063#comment:1>