Changes between Version 2 and Version 3 of ListColumns


Ignore:
Timestamp:
Oct 13, 2010, 7:29:46 AM (14 years ago)
Author:
Alex Kamedov
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ListColumns

    v2 v3  
    1919Arguments:
    2020
    21  * field_name - model field or model method name
     21 * field_name - calable function or string with model field, Model method name or current ModelAdmin method name.
    2222
    2323Keyword arguments:
    2424
     25 * header - change list column header. If not provided standard algorithm to header column calculation will be used.
    2526
    26  * header - change list column header. If not provided standard algoritm to header column calculation will be used.
     27 * filter - template filters will be apllied to value on output. It is string like this 'filter1|filter2:"arg"'.
    2728
    28  * filter - template filters will be apllied to value on output.
     29 * load_filters - list of required template tags libraries. This libraries will be load before apply template filters to output value. Eg.: ['tagging_tags', 'tagging_autocomplite_tags']
    2930
    30  * load_filters - list of required template tags libraries. This libraries will be load before apply template filters to output value.
     31 * order_field - string with model field name witch will be used to provide order by this column. If it provided for callable functions, its will be called with this field value in first argument instead of current object instance (this feature exists at least at svn rev. 14188 but currently is not documented).
    3132
    32  * order_field - specify witch field will be used to prowide order by this column.
    33 
    34  * value_map - choices used to mapping display value
     33 * value_map - choices used to mapping display value. This can redefine choices from model field for shown in admin changelist.
    3534
    3635==== Example ====
     
    4948        return ...
    5049    get_bar_column.allow_tags = True
     50    get_bar_column.short_description = 'Bar'
    5151
    5252    def timeuntil_ends():
     
    7373
    7474class AccountAdmin(admin.ModelAdmin):
     75
     76    def formated_bonk(bonk):
     77        return ...
     78
    7579    list_display = [
    76         admin.ListColumn('foo', header='Foo Description', filter='boolean'),
     80        admin.ListColumn('foo', header='Foo Description', filter='boolean_icon'),
    7781        admin.ListColumn('get_bar', filter='safe', order_field='bar'),
    7882        'baz',
    7983        'bonk',
    80         admin.ListColumn('ends', filter='timeuntil', header="Ending in")
     84        admin.ListColumn('ends', filter='timeuntil', header="Ending in"),
     85        admin.ListColumn('formated_bonk', order_field="bonk")
    8186    ]
    8287
Back to Top