diff --git a/django/contrib/admin/media/css/forms.css b/django/contrib/admin/media/css/forms.css index 2a1a0995a0..234a21ba79 100644 --- a/django/contrib/admin/media/css/forms.css +++ b/django/contrib/admin/media/css/forms.css @@ -58,19 +58,21 @@ fieldset.monospace textarea { font-family:"Bitstream Vera Sans Mono",Monaco,"Cou .vLargeTextField, .vXMLLargeTextField { width:48em; } .flatpages-flatpage #id_content { height:40.2em; } .module table .vPositiveSmallIntegerField { width:2.2em; } +.vTextField { width:20em; } +.vIntegerField { width:5em; } /* x unsorted */ -.inline-group {padding:10px; padding-bottom:5px; background:#eee; margin:10px 0;} -.inline-group h3.header {margin:-5px -10px 5px -10px; background:#bbb; color:#fff; padding:2px 5px 3px 5px; font-size:11px} -.inline-related {margin-bottom:15px; position:relative;} -.last-related {margin-bottom:0px;} -.inline-related h2 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; color:#888; } -.inline-related h2 b {font-weight:normal; color:#aaa;} -.inline-related h2 span.delete {padding-left:20px; position:absolute; top:0px; right:5px;} -.inline-related h2 span.delete label {margin-left:2px; padding-top:1px;} -.inline-related fieldset {background:#fbfbfb;} -.inline-related fieldset.module h2 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; background:#bcd; color:#fff; } +.inline-group {padding:0; border:1px solid #ccc; margin:10px 0;} +.inline-group .aligned label { width: 7em; } + +.inline-related {position:relative;} +.inline-related h3 {margin: 0; color:#666; padding:3px 5px; font-size:11px; background:#e1e1e1 url(../img/admin/nav-bg.gif) top left repeat-x; border-bottom:1px solid #ddd;} +.inline-related h3 span.delete {padding-left:20px; position:absolute; top:2px; right:10px;} +.inline-related h3 span.delete label {margin-left:2px; font-size: 11px;} +.inline-related fieldset {margin: 0; background:#fff; border: none; } +.inline-related fieldset.module h3 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; background:#bcd; color:#fff; } .inline-related.tabular fieldset.module table {width:100%;} +.last-related fieldset {border: none;} .inline-group .tabular tr.has_original td {padding-top:2em;} .inline-group .tabular tr td.original { padding:2px 0 0 0; width:0; _position:relative; } diff --git a/django/contrib/admin/media/css/global.css b/django/contrib/admin/media/css/global.css index d50601bde7..a4e5fd3d7f 100644 --- a/django/contrib/admin/media/css/global.css +++ b/django/contrib/admin/media/css/global.css @@ -97,7 +97,7 @@ input[type=submit].default:active { background-image:url(../img/admin/default-bg .module blockquote { margin-left:12px; } .module ul, .module ol { margin-left:1.5em; } .module h3 { margin-top:.6em; } -.module h2, .module caption { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; background:#7CA0C7 url(../img/admin/default-bg.gif) top left repeat-x; color:white; } +.module h2, .module caption, .inline-group h2 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; background:#7CA0C7 url(../img/admin/default-bg.gif) top left repeat-x; color:white; } .module table { border-collapse: collapse; } /* MESSAGES & ERRORS */ diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index b373200d8c..5f5c123e8d 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -145,6 +145,7 @@ class BaseModelAdmin(object): 'class': get_ul_class(self.radio_fields[db_field.name]), } ) + return db_field.formfield(**kwargs) else: # Otherwise, use the default select widget. return db_field.formfield(**kwargs) @@ -164,7 +165,27 @@ class BaseModelAdmin(object): if isinstance(db_field, models.TimeField): kwargs['widget'] = widgets.AdminTimeWidget return db_field.formfield(**kwargs) + + # For TextFields, add a custom CSS class. + if isinstance(db_field, models.TextField): + kwargs['widget'] = widgets.AdminTextareaWidget + return db_field.formfield(**kwargs) + + # For URLFields, add a custom CSS class. + if isinstance(db_field, models.URLField): + kwargs['widget'] = widgets.AdminURLFieldWidget + return db_field.formfield(**kwargs) + + # For IntegerFields, add a custom CSS class. + if isinstance(db_field, models.IntegerField): + kwargs['widget'] = widgets.AdminIntegerFieldWidget + return db_field.formfield(**kwargs) + # For TextInputs, add a custom CSS class. + if isinstance(db_field, models.CharField): + kwargs['widget'] = widgets.AdminTextInputWidget + return db_field.formfield(**kwargs) + # For FileFields and ImageFields add a link to the current file. if isinstance(db_field, models.ImageField) or isinstance(db_field, models.FileField): kwargs['widget'] = widgets.AdminFileWidget diff --git a/django/contrib/admin/templates/admin/edit_inline/stacked.html b/django/contrib/admin/templates/admin/edit_inline/stacked.html index c726b0fcda..217791f658 100644 --- a/django/contrib/admin/templates/admin/edit_inline/stacked.html +++ b/django/contrib/admin/templates/admin/edit_inline/stacked.html @@ -1,14 +1,14 @@ {% load i18n %}
+

{{ inline_admin_formset.opts.verbose_name_plural|title }}

{{ inline_admin_formset.formset.management_form }} -{#

{{ inline_admin_formset.opts.verbose_name_plural|title }}

#} {{ inline_admin_formset.formset.non_form_errors }} {% for inline_admin_form in inline_admin_formset %}