Code

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#1477 closed defect (fixed)

[patch] URLField is limited to a maxlength of 200

Reported by: favo Owned by: adrian
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@…> 8 years ago.
add maxlength argument to URLField
URLField-db-maxlength.diff (3.3 KB) - added by Robert Bunting 8 years ago.
adds db backend support for URLField maxlength
URLField-db-maxlength-4293.diff (3.4 KB) - added by mcroydon 8 years ago.
Updated to apply cleanly against trunk [4293]

Download all attachments as: .zip

Change History (16)

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

add maxlength argument to URLField

comment:1 Changed 8 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 8 years ago by anonymous

  • milestone changed from Version 0.91 to Version 0.93
  • Type changed from defect to enhancement

comment:3 Changed 8 years ago by mattmcc

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

Adding [patch] to summary

comment:4 Changed 8 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:5 follow-up: Changed 8 years ago by adrian

  • milestone Version 0.93 deleted

Milestone Version 0.93 deleted

Changed 8 years ago by Robert Bunting

adds db backend support for URLField maxlength

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

  • Resolution fixed deleted
  • Status changed from closed to reopened

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 8 years ago by Gary Wilson <gary.wilson@…>

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

Changed 8 years ago by mcroydon

Updated to apply cleanly against trunk [4293]

comment:8 Changed 8 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 8 years ago by mcroydon

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

comment:10 Changed 8 years ago by jacob

  • Resolution set to fixed
  • Status changed from reopened to closed

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

comment:11 in reply to: ↑ description Changed 7 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 7 years ago by anonymous

Replying to adrian:

Milestone Version 0.93 deleted

comment:13 Changed 7 years ago by anonymous

mnömçöçmöç

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.