#16117: Provide decorators to easily mark functions/methods as list_display
items
or admin actions
-------------------------------+------------------------------------
Reporter: haras | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version:
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Comment (by funkybob):
In discussion with someone this morning, I whipped up this
{{{
class admin_list(object):
def __init__(self, boolean=None, order_field=None, allow_tags=None,
short_description=None):
self.boolean = boolean
self.order_field = order_field
self.allow_tags = allow_tags
self.short_description=short_description
def __call__(self, attr):
if self.boolean is not None:
attr.boolean = self.boolean
if self.order_field is not None:
attr.admin_order_field = self.order_field
if self.allow_tags is not None:
attr.allow_tags = self.allow_tags
if self.short_description is not None:
attr.short_description = short_description
return attr
}}}
Then asked if anyone thought it'd be useful, and @timgraham pointed me to
this ticket. I'll dump this here for now... feel free to bike shed the
names, or I'll make a PR if you like.
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.a706b3d3558c3500eeb360e06bb1be3d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.