Use update wrapper on admin_field decorator
This commit is contained in:
parent
e033fe3865
commit
9ff6491e4f
2
TODO.md
2
TODO.md
|
@ -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
|
# SAVE INISTIAL PASSWORD from all services, and just use it to create the service, never update it
|
||||||
|
|
||||||
# Don't use system groups for unixmailbackends
|
# 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
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from functools import wraps, partial
|
from functools import wraps, partial, update_wrapper
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.admin import helpers
|
from django.contrib.admin import helpers
|
||||||
|
@ -22,6 +22,7 @@ def admin_field(method):
|
||||||
kwargs['short_description'] = kwargs.get('short_description',
|
kwargs['short_description'] = kwargs.get('short_description',
|
||||||
kwargs['field'].split('__')[-1].replace('_', ' ').capitalize())
|
kwargs['field'].split('__')[-1].replace('_', ' ').capitalize())
|
||||||
admin_method = partial(method, **kwargs)
|
admin_method = partial(method, **kwargs)
|
||||||
|
admin_method = update_wrapper(admin_method, method)
|
||||||
admin_method.short_description = kwargs['short_description']
|
admin_method.short_description = kwargs['short_description']
|
||||||
admin_method.allow_tags = True
|
admin_method.allow_tags = True
|
||||||
admin_method.admin_order_field = kwargs['order']
|
admin_method.admin_order_field = kwargs['order']
|
||||||
|
|
|
@ -6,4 +6,5 @@ from orchestra.admin.utils import admin_date
|
||||||
|
|
||||||
display_last_run_at = admin_date('last_run_at', short_description=_("Last run"))
|
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')
|
PeriodicTaskAdmin.list_display = ('__unicode__', display_last_run_at, 'total_run_count', 'enabled')
|
||||||
|
|
Loading…
Reference in a new issue