== Admin change list view customization with ListColumn == Related ticket: #8054 Move method properties for admin list customisation to ModelAdmin This ticket adds: * beatifull API to admin change list customization * ability to customize and localize 3rd-party application without fork it * ability to apply custom template filters on field value or model method returned value without any magic * ability to specify witch field will be used in order for column based on model method ==== ListColumn API ==== Arguments: * field_name - calable function or string with model field, Model method name or current ModelAdmin method name. Keyword arguments: * header - change list column header. If not provided standard algorithm to header column calculation will be used. * filter - template filters will be apllied to value on output. It is string like this 'filter1|filter2:"arg"'. * 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'] * 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). * value_map - choices used to mapping display value. This can redefine choices from model field for shown in admin changelist. ==== Example ==== Current way to admin change list view customization: {{{ class Account(models.Model): foo = model.BooleanField(...) bar = model.CharField(...) baz = model.CharField(...) bonk = model.CharField(...) ends = models.DateTimeField() def get_bar_column(self): return ... get_bar_column.allow_tags = True get_bar_column.short_description = 'Bar' def timeuntil_ends(): return ... class AccountAdmin(admin.ModelAdmin): list_display = ['foo', 'get_bar_column', 'baz', 'bonk', 'timeuntil_ends'] }}} Proposed way: {{{ class Account(models.Model): foo = model.BooleanField(...) bar = model.CharField(...) baz = model.CharField(...) bonk = model.CharField(...) ends = models.DateTimeField() def get_bar(self): return ... class AccountAdmin(admin.ModelAdmin): def formated_bonk(bonk): return ... list_display = [ admin.ListColumn('foo', header='Foo Description', filter='boolean_icon'), admin.ListColumn('get_bar', filter='safe', order_field='bar'), 'baz', 'bonk', admin.ListColumn('ends', filter='timeuntil', header="Ending in"), admin.ListColumn('formated_bonk', order_field="bonk") ] }}}