diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 18c7ae4..a7ad90e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,7 +1,7 @@ [bumpversion] commit = True tag = True -current_version = 1.3.01 +current_version = 1.3.02 parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\-(?P[a-z]+))? serialize = {major}.{minor}.{patch}-{release} diff --git a/background_task/__init__.py b/background_task/__init__.py index 808f054..158d416 100644 --- a/background_task/__init__.py +++ b/background_task/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -__version__ = "1.3.01" +__version__ = "1.3.02" default_app_config = "background_task.apps.BackgroundTasksAppConfig" diff --git a/background_task/admin.py b/background_task/admin.py index a7d6635..f7e3401 100644 --- a/background_task/admin.py +++ b/background_task/admin.py @@ -8,24 +8,57 @@ def inc_priority(modeladmin, request, queryset): for obj in queryset: obj.priority += 1 obj.save() + + inc_priority.short_description = "priority += 1" + def dec_priority(modeladmin, request, queryset): for obj in queryset: obj.priority -= 1 obj.save() + + dec_priority.short_description = "priority -= 1" + class TaskAdmin(admin.ModelAdmin): - display_filter = ['task_name'] - search_fields = ['task_name', 'task_params', ] - list_display = ['task_name', 'task_params', 'run_at', 'priority', 'attempts', 'has_error', 'locked_by', 'locked_by_pid_running', ] + display_filter = ["task_name"] + search_fields = [ + "task_name", + "task_params", + ] + list_display = [ + "task_name", + "task_params", + "run_at", + "priority", + "attempts", + "has_error", + "locked_by", + "locked_by_pid_running", + ] actions = [inc_priority, dec_priority] + list_filter = ["task_name", "has_error", "attempts", "priority"] + class CompletedTaskAdmin(admin.ModelAdmin): - display_filter = ['task_name'] - search_fields = ['task_name', 'task_params', ] - list_display = ['task_name', 'task_params', 'run_at', 'priority', 'attempts', 'has_error', 'locked_by', 'locked_by_pid_running', ] + display_filter = ["task_name"] + search_fields = [ + "task_name", + "task_params", + ] + list_display = [ + "task_name", + "task_params", + "run_at", + "priority", + "attempts", + "has_error", + "locked_by", + "locked_by_pid_running", + ] + list_filter = ["task_name", "has_error", "attempts", "priority"] admin.site.register(Task, TaskAdmin)