﻿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
25134	Add a decorator to escapsulate admin method properties	Jaap Roes	nobody	"While doing some heavy admin customisation I got fed up repeating function names to add `short_description`, `admin_order_field` (etc.) to helpers used in `list_display`. So I created a decorator that does it for me. It has the added benefit of enabling autocompletion on the possible options for `list_display` methods in PyCharm.

{{{
def list_display_method(short_description=None, allow_tags=False, boolean=False, admin_order_field=None):
    """"""
    Convenient decorator for display functions used in admin list_display.
    """"""
    def inner(func):
        func.short_description = short_description or func.__name__
        func.allow_tags = allow_tags
        func.boolean = boolean
        func.admin_order_field = admin_order_field
        return func
    return inner
}}}

Used like this:

{{{
@list_display_method(_('Some description'), admin_order_field='other_field')
def show_other_field(obj):
     return obj.other_field
}}}

Would something like this be eligible for inclusion in `contrib.admin`?"	New feature	closed	contrib.admin	dev	Normal	duplicate	list_display method decorator		Accepted	0	0	0	0	0	0
