Changes between Version 8 and Version 9 of ListColumns


Ignore:
Timestamp:
Oct 27, 2010, 11:25:16 AM (14 years ago)
Author:
Alex Kamedov
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ListColumns

    v8 v9  
    3131
    3232 * value_map - choices used to mapping display value. This can redefine choices from model field for shown in admin change list. If filter argument is provided, this is applied before template filters.
     33
     34
     35====== Work with list_display_link ModelAdmin property ======
     36
     37If list_display_link ModelAdmin property isn't provided, a first of list_display items will be used as link on object change form.
     38
     39In list_display_link you can use the same items as you can use in list_display. It can be a model field, property or methods, ModelAdmin methods, functions or ListColumn instances. Note: all items of list_display_link must be exists in list_display too.
     40
    3341
    3442==== Example ====
     
    7785
    7886    bar_column = admin.ListColumn('get_bar', filter='safe', order_field='bar')
     87    formated_bonk = admin.ListColumn('formated_bonk', order_field="bonk")
    7988
    8089    list_display = [
     
    8392        admin.ListColumn('baz', filter='truncatewords:"2"|slugify'),
    8493        'bonk',
    85         admin.ListColumn('ends', filter='timeuntil', header="Ending in"),
    86         admin.ListColumn('formated_bonk', order_field="bonk")
     94        formated_bonk,
     95        admin.ListColumn('ends', filter='timeuntil', header="Ending in")
    8796    ]
    8897    list_display_link = [bar_column, 'bonk']
     
    102111}}}
    103112
     113Links will be only on 1st (bar_column is the property of AccountAdmin and ListColumn instance) and 4th ('bonk' is the Acount model field) columns. formated_bonk is not in list_display_link and not will be with link, although formated_bonk and 'bonk' are the same model field. 'bonk' and formated_bonk is defferent essence in list_display and in list_display_link too.
Back to Top