Opened 10 years ago
Closed 10 years ago
#6281 closed (duplicate)
models.SlugField has no formfield() method
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | master |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | UI/UX: |
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)
Change History (7)
Changed 10 years ago by
Attachment: | 6281-slugfield-formfield.patch added |
---|
comment:1 Changed 10 years ago by
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 Changed 10 years ago by
Changed 10 years ago by
Attachment: | slugfield-as-regexfield.patch added |
---|
comment:3 Changed 10 years ago by
Needs tests: | unset |
---|
comment:4 Changed 10 years ago by
Looks good, jag.
Don't think you need the max_length
line, because the super method will handle this.
comment:5 Changed 10 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
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