Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#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)

localflavor.us.models.usstatefield.2.diff (2.4 KB ) - added by Paul McLanahan 16 years ago.
Updated version that actually works.
localflavor.us.models.usstatefield.3.diff (1.2 KB ) - added by Paul McLanahan 16 years ago.
One more try, this time without appending.
localflavor.us.models.usstatefield.diff (6.2 KB ) - added by Paul McLanahan 15 years ago.

Download all attachments as: .zip

Change History (9)

by Paul McLanahan, 16 years ago

Updated version that actually works.

by Paul McLanahan, 16 years ago

One more try, this time without appending.

comment:1 by Paul McLanahan, 16 years ago

Owner: changed from nobody to Paul McLanahan
Status: newassigned

comment:2 by Alex Gaynor, 15 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

by Paul McLanahan, 15 years ago

comment:3 by Paul McLanahan, 15 years ago

Needs tests: unset
Owner: changed from Paul McLanahan to Karen Tracey
Status: assignednew

Patch updated with tests.

comment:4 by Karen Tracey, 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 Karen Tracey, 15 years ago

Resolution: fixed
Status: newclosed

(In [11857]) Fixed #10969: Made US State field a CharField, fixing a few oddities in its behavior. Thanks Paul McLanahan.

comment:6 by Karen Tracey, 15 years ago

(In [11859]) [1.1.X] Fixed #10969: Made US State field a CharField, fixing a few oddities in its behavior. Thanks Paul McLanahan.

r11847 from trunk.

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