Opened 17 years ago

Closed 16 years ago

#6281 closed (duplicate)

models.SlugField has no formfield() method

Reported by: Collin Grady <cgrady@…> Owned by: nobody
Component: Forms Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

At present, models.SlugField returns a forms.CharField since it just inherits the default formfield method from models.CharField - as such, the form does no validation to be sure it's a valid slug.

Attachments (2)

6281-slugfield-formfield.patch (773 bytes ) - added by Collin Grady <cgrady@…> 17 years ago.
slugfield-as-regexfield.patch (1.8 KB ) - added by Joshua "jag" Ginsberg <jag@…> 17 years ago.

Download all attachments as: .zip

Change History (7)

by Collin Grady <cgrady@…>, 17 years ago

comment:1 by Chris Beaven, 17 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

comment:2 by Joshua "jag" Ginsberg <jag@…>, 17 years ago

Another patch for your consideration -- this one follows the model of other formfield methods in that it preserves the values given in kwargs, it contains unit tests, and it is sensitive to max_length.

-jag

by Joshua "jag" Ginsberg <jag@…>, 17 years ago

comment:3 by Collin Grady, 16 years ago

Needs tests: unset

comment:4 by Chris Beaven, 16 years ago

Looks good, jag.

Don't think you need the max_length line, because the super method will handle this.

comment:5 by Matt McClanahan, 16 years ago

Resolution: duplicate
Status: newclosed

This was duped by #8040, which was fixed in [8477].

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