Opened 5 years ago
Closed 5 years ago
#31063 closed Bug (duplicate)
Make URL validators consistent.
Reported by: | Alexandre Sapet | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Normal | Keywords: | url validator |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
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.
Change History (1)
comment:1 by , 5 years ago
Component: | contrib.admin → Core (Other) |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
Summary: | Make URL validators consistent between django/core/validators.URLValidator (for admin) django/db/models/fields.URLField (urllib) → Make URL validators consistent. |
Version: | 2.2 → master |
Note:
See TracTickets
for help on using tickets.
In both cases Django uses the same validator
django.core.validators.URLValidator
. Note thatModel.save()
doesn't validate fields (see documentation). You can subclassURLField
and adds3
to the list of accepted schemas, e.g.Solving #25594 should make it easier.
Duplicate of #26418.