Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#1477 closed defect (fixed)

[patch] URLField is limited to a maxlength of 200

Reported by: favo Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: master
Severity: normal Keywords:
Cc: gary.wilson@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

URLField is limit to 200 maxlenght, and not expose a agrument to change, hope that fix in next version of Django.

Attachments (3)

urlfield_maxlength.diff (816 bytes) - added by Julien Poissonnier <poissonnier@…> 11 years ago.
add maxlength argument to URLField
URLField-db-maxlength.diff (3.3 KB) - added by Robert Bunting 10 years ago.
adds db backend support for URLField maxlength
URLField-db-maxlength-4293.diff (3.4 KB) - added by mcroydon 10 years ago.
Updated to apply cleanly against trunk [4293]

Download all attachments as: .zip

Change History (16)

Changed 11 years ago by Julien Poissonnier <poissonnier@…>

Attachment: urlfield_maxlength.diff added

add maxlength argument to URLField

comment:1 Changed 11 years ago by Julien Poissonnier <poissonnier@…>

Note: the attached patch is for the magic-removal branch. I've never used another Django version so I am not sure if this works for other versions.

comment:2 Changed 11 years ago by anonymous

milestone: Version 0.91Version 0.93
Type: defectenhancement

comment:3 Changed 11 years ago by Matt McClanahan

Summary: URLField is limit to 200 maxlenght, and not expose a agrument to change[patch] URLField is limit to 200 maxlenght, and not expose a agrument to change

Adding [patch] to summary

comment:4 Changed 11 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [2874]) Fixed #1477 -- Made maxlength overridablef for URLField formfield

comment:5 Changed 10 years ago by Adrian Holovaty

milestone: Version 0.93

Milestone Version 0.93 deleted

Changed 10 years ago by Robert Bunting

Attachment: URLField-db-maxlength.diff added

adds db backend support for URLField maxlength

comment:6 Changed 10 years ago by Robert Bunting <robert@…>

Resolution: fixed
Status: closedreopened

r2874 made the formfield handle maxlength properly, but the db backends still hardcoded a length of 200 for URLField. So your form would allow >200 chars, but the generated sql for the database still created a field of 200 chars.

The above patch fixes this (URLField subclasses CharField much like EmailField does, but has maxlength definable like SlugField). Of course, this would also allow you to save space by using shorter URLFields if you knew you were able to.

comment:7 Changed 10 years ago by Gary Wilson <gary.wilson@…>

Cc: gary.wilson@… added
Summary: [patch] URLField is limit to 200 maxlenght, and not expose a agrument to change[patch] URLField is limited to a maxlength of 200
Type: enhancementdefect

Changed 10 years ago by mcroydon

Updated to apply cleanly against trunk [4293]

comment:8 Changed 10 years ago by mcroydon

I'm not aware of any side effects this change might have, but the only test I can get to fail after applying this patch is completely unreleated to URLFields.

comment:9 Changed 10 years ago by mcroydon

To clarify, the only test that is failing was already failing before applying this patch.

comment:10 Changed 10 years ago by Jacob

Resolution: fixed
Status: reopenedclosed

(In [4295]) Fixed #1477: URLFields now accept a maxlength parameter. Thanks, Matt Croydon.

comment:11 in reply to:  description Changed 10 years ago by 1477

Replying to favo:

URLField is limit to 200 maxlenght, and not expose a agrument to change, hope that fix in next version of Django.

comment:12 in reply to:  5 Changed 10 years ago by anonymous

Replying to adrian:

Milestone Version 0.93 deleted

comment:13 Changed 10 years ago by anonymous

mnömçöçmöç

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