Opened 19 years ago

Closed 17 years ago

#1665 closed enhancement (fixed)

[patch] Added "length" param to Field class

Reported by: robert.morris@… 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)

fields.py (40.7 KB ) - added by robert.morris@… 19 years ago.
Modified to take a "length" parameter, used in "size" attribute of HTML form fields
fields.py.diff (1.3 KB ) - added by robert.morris@… 19 years ago.

Download all attachments as: .zip

Change History (9)

by robert.morris@…, 19 years ago

Attachment: fields.py added

Modified to take a "length" parameter, used in "size" attribute of HTML form fields

by robert.morris@…, 19 years ago

Attachment: fields.py.diff added

comment:1 by robert.morris, 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 jbloom@…, 19 years ago

I'm voting for this option as well.
It'll make the Admin screens more flexible and useful.
-Josh

comment:3 by pb@…, 19 years ago

Also see discussion in ticket #872.

comment:4 by Malcolm Tredinnick, 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 Gary Wilson <gary.wilson@…>, 18 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

accepted as per Adrian's comments on the mailing list thread.

comment:6 by Philippe Raoult, 17 years ago

Keywords: feature added

comment:7 by James Bennett, 17 years ago

Resolution: fixed
Status: newclosed

The newforms library exposes the ability to do this, I believe, in which case this is fixed.

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