From 157ade371be84154f2ce465793531c72d82ecada Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Tue, 1 May 2007 02:35:15 +0000 Subject: [PATCH] Fixed #4084 -- Added formfield() support to the USStateField model field. Thanks, polpak@yahoo.com. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5130 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- AUTHORS | 1 + django/db/models/fields/__init__.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/AUTHORS b/AUTHORS index 564cd0a139..d0bf6502de 100644 --- a/AUTHORS +++ b/AUTHORS @@ -181,6 +181,7 @@ answer newbie questions, and generally made Django that much better: Luke Plant plisk Daniel Poelzleithner + polpak@yahoo.com J. Rademaker Michael Radziej ramiro diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 3849ee73b9..ba2e362f3a 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -869,6 +869,12 @@ class USStateField(Field): def get_manipulator_field_objs(self): return [oldforms.USStateField] + def formfield(self, **kwargs): + from django.contrib.localflavor.us.forms import USStateSelect + defaults = {'widget': USStateSelect} + defaults.update(kwargs) + return super(USStateField, self).formfield(**defaults) + class XMLField(TextField): def __init__(self, verbose_name=None, name=None, schema_path=None, **kwargs): self.schema_path = schema_path