﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
8054	Move method properties for admin list customisation to ModelAdmin	Daniel Pope <dan@…>	Brian Rosner	"The current approach for customising {{{list_display}}} seems contrary to the spirit of newforms-admin. Method properties such as {{{.short_description}}}, {{{.boolean}}} and {{{.allow_tags}}} rarely belong in the model definition.

In fact, I noted that these options, for customising the look of the list column, duplicate filter functionality. {{{.allow_tags}}} is exactly {{{|safe}}}; {{{|boolean}}} could be a filter provided by {{{django.contrib.admin.templatetags}}}. The case is much more convincing when you take into account user-defined filters: if I already have a filter for presenting values for user consumption, I should not need to provide a model method to replicate or apply that filter.

I propose a syntax like this:

{{{
class AccountAdmin(admin.ModelAdmin):
    foo_column = admin.ListColumn('foo', heading='Foo Description', filter='boolean')
    get_bar_column = admin.ListColumn('get_bar', filter='safe', order_field='bar')

    list_display = [foo_column, get_bar_column, 'baz', 'bonk']
}}}

Filter would be specified in exactly template syntax for convenience, so
{{{
   get_bar_column = admin.ListColumn('get_bar', filter='truncatewords:""2""|slugify')
}}}

would render exactly the same as

{{{
{{row.get_bar|truncatewords:""2""|slugify}}
}}}
"		closed	contrib.admin	dev		fixed		andy@… kamedov@… renatopedigoni@… Alexander Koshelev	Accepted	1	1	0	0	0	0
