Opened 10 years ago

Closed 9 years ago

#3557 closed (fixed)

SlugField not correctly autopopulated / has no max_length

Reported by: Russell Cloran <russell@…> Owned by: Adrian Holovaty
Component: Forms Version: newforms-admin
Severity: Keywords: newforms newforms-admin slugfield
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The SlugField returns a forms.CharField, but does not set the max_length attribute.

That means that in newforms-admin auto-population of the field doesn't work. As well as many other Bad Things.

I think that subclassing the CharField is the way to go here. If not, the alternative method (copy-paste bits out of the CharField class) is also a trivial patch.

Attachments (2)

slugfield.patch (1.0 KB) - added by Russell Cloran <russell@…> 10 years ago.
Patch to fix SlugField in newforms
slugfield.2.patch (9.9 KB) - added by Russell Cloran <russell@…> 10 years ago.
Patch to fix SlugField in newforms. Incl new tests.

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by Russell Cloran <russell@…>

Attachment: slugfield.patch added

Patch to fix SlugField in newforms

comment:1 Changed 10 years ago by Simon G. <dev@…>

Component: Uncategorizeddjango.newforms
Owner: changed from Jacob to Adrian Holovaty
Triage Stage: UnreviewedAccepted

Changed 10 years ago by Russell Cloran <russell@…>

Attachment: slugfield.2.patch added

Patch to fix SlugField in newforms. Incl new tests.

comment:2 Changed 10 years ago by Russell Cloran <russell@…>

Keywords: newforms added
Version: newforms branchSVN

comment:3 Changed 9 years ago by Brian Rosner <brosner@…>

Just as a point of reference it looks like r6056 in newforms-admin solved this. Once that branch gets merged in this ticket can be closed.

comment:4 Changed 9 years ago by Russell Cloran <russell@…>

Version: SVNnewforms-admin

This should not be closed without the regression tests being committed.

comment:5 Changed 9 years ago by Gary Wilson

Resolution: fixed
Status: newclosed

(In [6065]) Fixed #3557 -- Made SlugField inherit from CharField so that its max_length is properly set. Removed get_manipulator_field_objs method since it's already provided by CharField. Thanks, Russell Cloran.

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