#11195: add fieldname to admin changelist <td> tags -- eases CSS customization
---------------------------------------+-------------------------------
               Reporter:  akaihola     |          Owner:  nobody
                   Type:  New feature  |         Status:  new
              Milestone:               |      Component:  contrib.admin
                Version:  SVN          |       Severity:  Normal
             Resolution:               |       Keywords:  css
           Triage Stage:  Accepted     |      Has patch:  1
    Needs documentation:  1            |    Needs tests:  0
Patch needs improvement:  0            |  Easy pickings:  0
---------------------------------------+-------------------------------
Changes (by vdboor):

 * easy:   => 0


Comment:

 Suggestion.

 what I've done in my custom admin_list.py implementation is the following:

 {{{
     list_column_classes = getattr(cl.model_admin, 'list_column_classes')
 or {}

     for field_name in cl.list_display:
         # ....

         column_class = list_column_classes.get(field_name)
         if column_class:
             row_classes.append(column_class)
 }}}

 * This allows the developers to define a `list_column_classes` attribute
 on a `ModelAdmin`
 * Only the rows that really need a class have to included.

 Getting the HTML size trimmed down is one thing.
 Having an admin list with badly formatted column widths is far worse for
 clients.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11195#comment:6>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to