diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-08-28 20:58:10 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-08-28 20:58:10 +0000 |
| commit | a41ca9c9e284628c81f0a9b5a652a03ddbdd7521 (patch) | |
| tree | de70a4e800d9525014f67b919adcff35ce178026 /django/contrib/admin/options.py | |
| parent | fe8e00ae06f618ba001d8b0fea34d7846602bdc6 (diff) | |
| download | django-a41ca9c9e284628c81f0a9b5a652a03ddbdd7521.tar.gz | |
Fixed #8556: added a useful formfield to `CommaSeparatedIntegerField`. gkelly, mattmcc, and kratorius all contributed portions of this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8682 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib/admin/options.py')
| -rw-r--r-- | django/contrib/admin/options.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 930db7767e..696dd30387 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -94,6 +94,11 @@ class BaseModelAdmin(object): kwargs['widget'] = widgets.AdminIntegerFieldWidget return db_field.formfield(**kwargs) + # For CommaSeparatedIntegerFields, add a custom CSS class. + if isinstance(db_field, models.CommaSeparatedIntegerField): + kwargs['widget'] = widgets.AdminCommaSeparatedIntegerFieldWidget + return db_field.formfield(**kwargs) + # For TextInputs, add a custom CSS class. if isinstance(db_field, models.CharField): kwargs['widget'] = widgets.AdminTextInputWidget |
