diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
index fdf082b..316f3fe 100644
a
|
b
|
def result_headers(cl):
|
100 | 100 | # It is a non-field, but perhaps one that is sortable |
101 | 101 | admin_order_field = getattr(attr, "admin_order_field", None) |
102 | 102 | if not admin_order_field: |
103 | | yield {"text": header} |
| 103 | yield { |
| 104 | "text": header, |
| 105 | "class_attrib": mark_safe(' class="col-%s"' % field_name) |
| 106 | } |
104 | 107 | continue |
105 | 108 | |
106 | 109 | # So this _is_ a sortable non-field. Go to the yield |
… |
… |
def result_headers(cl):
|
108 | 111 | else: |
109 | 112 | admin_order_field = None |
110 | 113 | |
111 | | th_classes = [] |
| 114 | th_classes = ['col-' + field_name] |
112 | 115 | new_order_type = 'asc' |
113 | 116 | if field_name == cl.order_field or admin_order_field == cl.order_field: |
114 | 117 | th_classes.append('sorted %sending' % cl.order_type.lower()) |
… |
… |
def result_headers(cl):
|
118 | 121 | "text": header, |
119 | 122 | "sortable": True, |
120 | 123 | "url": cl.get_query_string({ORDER_VAR: i, ORDER_TYPE_VAR: new_order_type}), |
121 | | "class_attrib": mark_safe(th_classes and ' class="%s"' % ' '.join(th_classes) or '') |
| 124 | "class_attrib": mark_safe(' class="%s"' % ' '.join(th_classes)) |
122 | 125 | } |
123 | 126 | |
124 | 127 | def _boolean_icon(field_val): |
… |
… |
def items_for_result(cl, result, form):
|
131 | 134 | """ |
132 | 135 | first = True |
133 | 136 | pk = cl.lookup_opts.pk.attname |
| 137 | list_column_classes = getattr(cl.model_admin, 'list_column_classes', {}) |
134 | 138 | for field_name in cl.list_display: |
135 | 139 | row_class = '' |
| 140 | row_classes = [] |
136 | 141 | try: |
137 | 142 | f, attr, value = lookup_field(field_name, result, cl.model_admin) |
138 | 143 | except (AttributeError, ObjectDoesNotExist): |
… |
… |
def items_for_result(cl, result, form):
|
140 | 145 | else: |
141 | 146 | if f is None: |
142 | 147 | if field_name == u'action_checkbox': |
143 | | row_class = ' class="action-checkbox"' |
| 148 | row_classes = ['action-checkbox'] |
144 | 149 | allow_tags = getattr(attr, 'allow_tags', False) |
145 | 150 | boolean = getattr(attr, 'boolean', False) |
146 | 151 | if boolean: |
… |
… |
def items_for_result(cl, result, form):
|
166 | 171 | if isinstance(f, models.DateField)\ |
167 | 172 | or isinstance(f, models.TimeField)\ |
168 | 173 | or isinstance(f, models.ForeignKey): |
169 | | row_class = ' class="nowrap"' |
| 174 | row_classes.append('nowrap') |
170 | 175 | if force_unicode(result_repr) == '': |
171 | 176 | result_repr = mark_safe(' ') |
| 177 | column_class = list_column_classes.get(field_name) |
| 178 | if column_class: |
| 179 | row_classes.append(column_class) |
| 180 | if row_classes: |
| 181 | row_class = ' class="%s"' % ' '.join(row_classes) |
172 | 182 | # If list_display_links not defined, add the link tag to the first field |
173 | 183 | if (first and not cl.list_display_links) or field_name in cl.list_display_links: |
174 | 184 | table_tag = {True:'th', False:'td'}[first] |