Changes between Initial Version and Version 1 of Ticket #11195, comment 6


Ignore:
Timestamp:
Apr 22, 2011, 7:32:29 AM (14 years ago)
Author:
Diederik van der Boor

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11195, comment 6

    initial v1  
    44
    55{{{
    6     list_column_classes = getattr(cl.model_admin, 'list_column_classes') or {}
     6    list_column_classes = getattr(cl.model_admin, 'list_column_classes', {})
    77
    88    for field_name in cl.list_display:
    99        # ....
    1010
    11         column_class = list_column_classes.get(field_name)
    12         if column_class:
    13             row_classes.append(column_class)
     11        row_classes.append(list_column_classes.get(field_name, 'col-' + field_name))
    1412}}}
    1513
    16 * This allows the developers to define a `list_column_classes` attribute on a `ModelAdmin`
    17 * Only the rows that really need a class have to included.
     14This also allows the developers to define a `list_column_classes` attribute on a `ModelAdmin`
    1815
    1916Getting the HTML size trimmed down is one thing.
    2017Having an admin list with badly formatted column widths is far worse for clients.
     18I'd really like to see something like this by default in Django, to stop DRY implementations.
Back to Top