From 9ff6491e4fd8ff25ec8b82a3f9a76a41e362ad1f Mon Sep 17 00:00:00 2001 From: root Date: Mon, 21 Nov 2016 19:35:17 +0000 Subject: [PATCH] Use update wrapper on admin_field decorator --- TODO.md | 2 ++ orchestra/admin/decorators.py | 3 ++- orchestra/contrib/tasks/admin.py | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 26b041ab..6d794be6 100644 --- a/TODO.md +++ b/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 # 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 diff --git a/orchestra/admin/decorators.py b/orchestra/admin/decorators.py index 5daf00dd..55afdc20 100644 --- a/orchestra/admin/decorators.py +++ b/orchestra/admin/decorators.py @@ -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'] diff --git a/orchestra/contrib/tasks/admin.py b/orchestra/contrib/tasks/admin.py index 4c17b40a..bd249254 100644 --- a/orchestra/contrib/tasks/admin.py +++ b/orchestra/contrib/tasks/admin.py @@ -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')