#10969 closed (fixed)
django/contrib/localflavor/us/models.py update USStateField to act as a normal CharField with choices.
Reported by: | Paul McLanahan | Owned by: | Karen Tracey |
---|---|---|---|
Component: | contrib.localflavor | Version: | dev |
Severity: | Keywords: | usstatefield, charfield | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The current implementation of the USStateField model field in the localflavor/us module does not act like a normal CharField with choices. It does not cause the model to get a get_<fieldname>_display method, and it does not appear to obey blank=True rules like other CharFields would. It is for these reasons that I don't see why this can't be a simple subclass of django.db.models.fields.CharField.
Note: Possibly related to #4092.
Attachments (3)
Change History (9)
by , 16 years ago
Attachment: | localflavor.us.models.usstatefield.2.diff added |
---|
by , 16 years ago
Attachment: | localflavor.us.models.usstatefield.3.diff added |
---|
One more try, this time without appending.
comment:1 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 15 years ago
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
by , 15 years ago
Attachment: | localflavor.us.models.usstatefield.diff added |
---|
comment:3 by , 15 years ago
Needs tests: | unset |
---|---|
Owner: | changed from | to
Status: | assigned → new |
Patch updated with tests.
comment:4 by , 15 years ago
So #4092 notes the same problem but takes a different approach on fixing, introducing a new type of Widget (NullSelect), plus changing all(?) localflavor widgets to use this new type. The patch here just changes the field type for the US state field. Other localflavors don't need updating because they don't actually define fields, is that right? I'm just wondering if there is a problem with all these other localflavor lists that still needs to be dealt with or if the fix here resolves both this ticket and #4092. While the patches on #4092 touch all these different localflavors the actual problem description only mentions US states as being a problem...
comment:5 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Updated version that actually works.