Opened 18 years ago
Closed 17 years ago
#6281 closed (duplicate)
models.SlugField has no formfield() method
| Reported by: | 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)
Change History (7)
by , 18 years ago
| Attachment: | 6281-slugfield-formfield.patch added |
|---|
comment:1 by , 18 years ago
| Needs tests: | set |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 18 years ago
by , 18 years ago
| Attachment: | slugfield-as-regexfield.patch added |
|---|
comment:3 by , 17 years ago
| Needs tests: | unset |
|---|
comment:4 by , 17 years ago
Looks good, jag.
Don't think you need the max_length line, because the super method will handle this.
comment:5 by , 17 years ago
| 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