From fb0742802f2d738ae3de8b589139a5a93559bcc5 Mon Sep 17 00:00:00 2001 From: Dan Braghis Date: Fri, 3 Jul 2020 13:26:18 +0100 Subject: [PATCH] Include task description in choosers, if defined (#6200) --- docs/advanced_topics/custom_tasks.rst | 13 +++++++++++++ .../wagtailadmin/workflows/select_task_type.html | 5 ++++- .../task_chooser/includes/select_task_type.html | 5 ++++- wagtail/admin/tests/test_workflows.py | 1 + wagtail/admin/views/workflows.py | 6 +++--- wagtail/core/models.py | 9 +++++++++ 6 files changed, 34 insertions(+), 5 deletions(-) diff --git a/docs/advanced_topics/custom_tasks.rst b/docs/advanced_topics/custom_tasks.rst index 07c15d7905..a191464571 100644 --- a/docs/advanced_topics/custom_tasks.rst +++ b/docs/advanced_topics/custom_tasks.rst @@ -195,6 +195,19 @@ For example: return TaskState.objects.none() +``Task.get_description()``` + +A class method that returns the human-readable description for the task. + +For example: + +.. code-block:: python + + @classmethod + def get_description(cls): + return _("Members of the chosen Wagtail Groups can approve this task") + + Adding notifications ~~~~~~~~~~~~~~~~~~~~ diff --git a/wagtail/admin/templates/wagtailadmin/workflows/select_task_type.html b/wagtail/admin/templates/wagtailadmin/workflows/select_task_type.html index fd298084d5..8245cc424a 100644 --- a/wagtail/admin/templates/wagtailadmin/workflows/select_task_type.html +++ b/wagtail/admin/templates/wagtailadmin/workflows/select_task_type.html @@ -12,12 +12,15 @@ {% if task_types %}