Opened 19 years ago
Closed 17 years ago
#1665 closed enhancement (fixed)
[patch] Added "length" param to Field class
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | minor | Keywords: | feature |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Pretty much what the title says: I wanted to be able to specify the "size" attribute of form field both in the admin interface and in views using manipulators. My post in django-users in an old thread on the issue stirred up a "yes it's goofy -- make a patch" suggestion. So I did.
First patch submission, so I hope I did it right :)
Attachments (2)
Change History (9)
by , 19 years ago
by , 19 years ago
Attachment: | fields.py.diff added |
---|
comment:1 by , 19 years ago
TODO: make a comprehensive list of the field types that this can be used for; I initially thought that it would be valid for any field type subclassed from TextField, but that's not always true. IntegerField, PhoneNumberField, and USStateField are at least some field types that don't specify the length keyword, even though they are subclassed from TextField.
comment:2 by , 19 years ago
I'm voting for this option as well.
It'll make the Admin screens more flexible and useful.
-Josh
comment:4 by , 18 years ago
Before this can go into the tree, the TODO item from a couple of comments ago needs to be fixed (probably any field taking a maxlength
attribute can also take size
) and there should be a patch to the documentation (docs/model-api.txt
) as well.
comment:5 by , 18 years ago
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
accepted as per Adrian's comments on the mailing list thread.
comment:6 by , 17 years ago
Keywords: | feature added |
---|
comment:7 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The newforms library exposes the ability to do this, I believe, in which case this is fixed.
Modified to take a "length" parameter, used in "size" attribute of HTML form fields