This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/admin/views/tasks.py

24 lines
801 B
Python
Raw Normal View History

2020-10-16 09:28:54 +00:00
"""passbook Tasks List"""
from typing import Any, Dict
from django.views.generic.base import TemplateView
from passbook.admin.mixins import AdminRequiredMixin
from passbook.lib.tasks import TaskInfo, TaskResultStatus
2020-10-16 09:28:54 +00:00
class TaskListView(AdminRequiredMixin, TemplateView):
"""Show list of all background tasks"""
template_name = "administration/task/list.html"
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
kwargs = super().get_context_data(**kwargs)
2020-10-16 12:36:40 +00:00
kwargs["object_list"] = sorted(
TaskInfo.all().values(), key=lambda x: x.task_name
)
2020-10-16 09:28:54 +00:00
kwargs["task_successful"] = TaskResultStatus.SUCCESSFUL
kwargs["task_warning"] = TaskResultStatus.WARNING
kwargs["task_error"] = TaskResultStatus.ERROR
return kwargs