#13613 closed (fixed)
forms.URLField not default ModelForm URLField anymore
Reported by: | amadison | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.2 |
Severity: | Keywords: | ModelForm URLField | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Looks like with Changeset 11456 the ModelForm URLField stopped using the forms.FormField as it's default form field. Now it just uses a regular CharField but adds the validators.URLValidator.
There are two important things that were lost when this happened.
- the ModelForm does not add on the 'http://' if it is not present, so 'www.google.com' is an invalid url when using a ModelForm, but not a regular form.
- The error message on an invalid url is now the generic 'Enter a valid value.' instead of the more helpful 'Enter a valid URL.'.
Attached is a diff for making the ModelForm URLField use the default forms.URLField again as the docs describe here
I think this will make the validator run twice, but I think that's probably ok.
Attachments (1)
Change History (7)
by , 15 years ago
Attachment: | db_fields.diff added |
---|
comment:1 by , 15 years ago
Has patch: | set |
---|---|
milestone: | → 1.3 |
comment:2 by , 14 years ago
+1 for a fix, ideally in a 1.2.x release.
We're running into this bug as well since upgrading to 1.2.
comment:3 by , 14 years ago
Closed #13744 as a duplicate of this ticket.
Note to self, search open tickets before debugging Django as you can be sure someone has already created a ticket with the exact same patch two months prior.
comment:4 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
it is really a bug