Use update wrapper on admin_field decorator

This commit is contained in:
root 2016-11-21 19:35:17 +00:00
parent e033fe3865
commit 9ff6491e4f
3 changed files with 5 additions and 1 deletions

View File

@ -468,3 +468,5 @@ with open(file) as handler:
# SAVE INISTIAL PASSWORD from all services, and just use it to create the service, never update it
# Don't use system groups for unixmailbackends
# trigger a reload_relations on updates on monitors on all processes, not just current one. Alt. restart service

View File

@ -1,4 +1,4 @@
from functools import wraps, partial
from functools import wraps, partial, update_wrapper
from django.contrib import messages
from django.contrib.admin import helpers
@ -22,6 +22,7 @@ def admin_field(method):
kwargs['short_description'] = kwargs.get('short_description',
kwargs['field'].split('__')[-1].replace('_', ' ').capitalize())
admin_method = partial(method, **kwargs)
admin_method = update_wrapper(admin_method, method)
admin_method.short_description = kwargs['short_description']
admin_method.allow_tags = True
admin_method.admin_order_field = kwargs['order']

View File

@ -6,4 +6,5 @@ from orchestra.admin.utils import admin_date
display_last_run_at = admin_date('last_run_at', short_description=_("Last run"))
PeriodicTaskAdmin.list_display = ('__unicode__', display_last_run_at, 'total_run_count', 'enabled')