﻿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
7503	Allow list_display to take functions	qmanic@…	Brian Rosner	"Just a thought - some of the apps I've been writing require me to add additional columns to the change list for models in the admin interface. The way to do this currently add a method name to list_display which gets looked up on the model and called, e.g.:

{{{
#!python

class Account(models.Model):
    def my_func(self):
        # do admin stuff here and return a string

...

class AccountAdmin(admin.ModelAdmin):
    list_display = ('user', 'my_func', 'get_user_email', 'status', )
    
}}}

The thing is, my_func is something that would only ever be used as part of the admin (e.g.  I have one that is used to generate links to the admin page for a objects related by a ForeignKey) and I feel kind of dirty putting it on the model itself.

I've written up a hack-in-a-minute (i.e. needs work) patch that would allow you to do something like:

{{{
#!python

def my_func(object):
    # interrogate the object and return a string

class AccountAdmin(admin.ModelAdmin):
    list_display = ('user', my_func, 'get_user_email', 'status', )
    
}}}

Thoughts?"		closed	contrib.admin	dev		fixed			Accepted	1	0	0	0	0	0
