Opened 18 years ago
Closed 18 years ago
#4084 closed (fixed)
models.fields.USStateField missing newforms Field
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Forms | Version: | 0.96 |
Severity: | Keywords: | models USStateField | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The model has no formfield method, so it consequently shows up as a non-validating text input. This is not desirable.
I've attached a patch to have it use the django.contrib.localflavor.usa.forms.USStateSelect Field, but there also appears to be a bug there with the init method of the newforms field, so I'll file a separate bug for that one
Attachments (2)
Change History (8)
by , 18 years ago
Attachment: | models_usstatefield.patch added |
---|
comment:1 by , 18 years ago
Patch needs improvement: | set |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Sorry, shouldn't try to do this so late at night. The original patch won't do. It uses the widget rather than the form field. This one should work correctly.
by , 18 years ago
Attachment: | models_usstatefield.2.patch added |
---|
fixed patch which uses the correct form field and widget
comment:2 by , 18 years ago
Patch needs improvement: | unset |
---|---|
Resolution: | invalid |
Status: | closed → reopened |
comment:3 by , 18 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:4 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
I don't think this is a good change to make. The field should be validating already (it has a "clean" method), so I'm not sure what you mean by non-validating. It's reasonable to have it show up as a text field so that people can just quickly enter their state (either as an abbreviation or word).
If you want to use the !USStateSelect widget, you can pass that in as part of the constructor (all Field subclasses take a widget parameter). So the current behaviour is reasonable and it can be customised to taste in the normal way.
comment:5 by , 18 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
Whoops. This isn't about newforms at all. Reopening whilst I turn my brain on.
comment:6 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
patch to django/db/models/fields/init.py for 0.96