--
Ticket URL: <https://code.djangoproject.com/ticket/16117>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* component: Database layer (models, ORM) => contrib.admin
* needs_tests: => 0
* needs_docs: => 0
* type: Cleanup/optimization => New feature
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:1>
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:2>
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:3>
* ui_ux: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:4>
* cc: kmike84@… (added)
Comment:
I've released a simple app for this some time ago:
https://github.com/kmike/django-admin-decorators
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:6>
Comment (by timgraham):
#25134 is a duplicate with some discussion.
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:7>
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>
Comment (by collinanderson):
Also, keep in mind allow_tags is deprecated #25135.
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:9>
* keywords: =>
admin, actions, list_display, readonly_fields, methods,
short_description, admin_order_field, boolean, empty_value_display,
allowed_permissions
* owner: nobody => Nick Pope
* has_patch: 0 => 1
* version: => master
* status: new => assigned
Comment:
[https://github.com/django/django/pull/13532 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:10>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:11>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"920448539631b52dcee53bd32a880abbc9de18bd" 9204485]:
{{{
#!CommitTicketReference repository=""
revision="920448539631b52dcee53bd32a880abbc9de18bd"
Fixed #16117 -- Added decorators for admin action and display functions.
Refs #25134, #32099.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:12>
Comment (by GitHub <noreply@…>):
In [changeset:"8f02a78695a6c07bc5b05499e6e6cf96bc25320f" 8f02a78]:
{{{
#!CommitTicketReference repository=""
revision="8f02a78695a6c07bc5b05499e6e6cf96bc25320f"
Refs #16117 -- Made @action and @display decorators importable from
django.contrib.gis.admin.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:13>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"eccf40a3038bb38c4fd0e7c3ada03e7a9a02c091" eccf40a]:
{{{
#!CommitTicketReference repository=""
revision="eccf40a3038bb38c4fd0e7c3ada03e7a9a02c091"
[3.2.x] Refs #16117 -- Made @action and @display decorators importable
from django.contrib.gis.admin.
Backport of 8f02a78695a6c07bc5b05499e6e6cf96bc25320f from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16117#comment:14>