Opened 9 years ago

Closed 8 years ago

#3557 closed (fixed)

SlugField not correctly autopopulated / has no max_length

Reported by: Russell Cloran <russell@…> Owned by: adrian
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@…> 9 years ago.
Patch to fix SlugField in newforms
slugfield.2.patch (9.9 KB) - added by Russell Cloran <russell@…> 9 years ago.
Patch to fix SlugField in newforms. Incl new tests.

Download all attachments as: .zip

Change History (7)

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

Patch to fix SlugField in newforms

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

  • Component changed from Uncategorized to django.newforms
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from jacob to adrian
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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

Patch to fix SlugField in newforms. Incl new tests.

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

  • Keywords newforms added
  • Version changed from newforms branch to SVN

comment:3 Changed 8 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 8 years ago by Russell Cloran <russell@…>

  • Version changed from SVN to newforms-admin

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

comment:5 Changed 8 years ago by gwilson

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

(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