Changes between Version 8 and Version 9 of ListColumns
- Timestamp:
- Oct 27, 2010, 11:25:16 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ListColumns
v8 v9 31 31 32 32 * 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 37 If list_display_link ModelAdmin property isn't provided, a first of list_display items will be used as link on object change form. 38 39 In 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 33 41 34 42 ==== Example ==== … … 77 85 78 86 bar_column = admin.ListColumn('get_bar', filter='safe', order_field='bar') 87 formated_bonk = admin.ListColumn('formated_bonk', order_field="bonk") 79 88 80 89 list_display = [ … … 83 92 admin.ListColumn('baz', filter='truncatewords:"2"|slugify'), 84 93 '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") 87 96 ] 88 97 list_display_link = [bar_column, 'bonk'] … … 102 111 }}} 103 112 113 Links 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.