kopia lustrzana https://github.com/wagtail/wagtail
Added `AbstractGroupApprovalTask` to simplify customizing behavior
rodzic
aebdf82387
commit
068c3f2964
|
@ -124,6 +124,7 @@ Changelog
|
||||||
* Add API support for a redirects (contrib) endpoint (Rohit Sharma, Jaap Roes, Andreas Donig)
|
* Add API support for a redirects (contrib) endpoint (Rohit Sharma, Jaap Roes, Andreas Donig)
|
||||||
* Add the default ability for all `SnippetViewSet` & `ModelViewSet` to support being copied (Shlomo Markowitz)
|
* Add the default ability for all `SnippetViewSet` & `ModelViewSet` to support being copied (Shlomo Markowitz)
|
||||||
* Support dynamic Wagtail guide links in the admin that are based on the running version of Wagtail (Tidiane Dia)
|
* Support dynamic Wagtail guide links in the admin that are based on the running version of Wagtail (Tidiane Dia)
|
||||||
|
* Added `AbstractGroupApprovalTask` to simplify customizing behavior of custom `Task` models (John-Scott Atlakson)
|
||||||
* Fix: Update system check for overwriting storage backends to recognize the `STORAGES` setting introduced in Django 4.2 (phijma-leukeleu)
|
* Fix: Update system check for overwriting storage backends to recognize the `STORAGES` setting introduced in Django 4.2 (phijma-leukeleu)
|
||||||
* Fix: Prevent password change form from raising a validation error when browser autocomplete fills in the "Old password" field (Chiemezuo Akujobi)
|
* Fix: Prevent password change form from raising a validation error when browser autocomplete fills in the "Old password" field (Chiemezuo Akujobi)
|
||||||
* Fix: Ensure that the legacy dropdown options, when closed, do not get accidentally clicked by other interactions on wide viewports (CheesyPhoenix, Christer Jensen)
|
* Fix: Ensure that the legacy dropdown options, when closed, do not get accidentally clicked by other interactions on wide viewports (CheesyPhoenix, Christer Jensen)
|
||||||
|
|
|
@ -4,11 +4,16 @@ The Workflow system allows users to create tasks, which represent stages of mode
|
||||||
|
|
||||||
Wagtail provides one built-in task type: `GroupApprovalTask`, which allows any user in specific groups to approve or reject moderation.
|
Wagtail provides one built-in task type: `GroupApprovalTask`, which allows any user in specific groups to approve or reject moderation.
|
||||||
|
|
||||||
However, it is possible to implement your own task types. Instances of your custom task can then be created in the `Tasks` section of the Wagtail Admin.
|
However, it is possible to implement your own task types. Instances of your custom task can then be created in the Workflow tasks section of the Wagtail Admin.
|
||||||
|
|
||||||
## Task models
|
## Task models
|
||||||
|
|
||||||
All custom tasks must be models inheriting from `wagtailcore.Task`. In this set of examples, we'll set up a task that can be approved by only one specific user.
|
All custom tasks must be models inheriting from `wagtailcore.Task`.
|
||||||
|
|
||||||
|
If you need to customize the behavior of the built-in `GroupApprovalTask`, create a custom task which inherits from `AbstractGroupApprovalTask` and add your customizations there.
|
||||||
|
See below for more details on how to customize behavior.
|
||||||
|
|
||||||
|
In this set of examples, we'll set up a task that can be approved by only one specific user.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# <project>/models.py
|
# <project>/models.py
|
||||||
|
|
|
@ -27,6 +27,7 @@ depth: 1
|
||||||
* Implement new universal listings design for image listing view (Sage Abdullah)
|
* Implement new universal listings design for image listing view (Sage Abdullah)
|
||||||
* Implement new universal listings design for document listing view (Sage Abdullah)
|
* Implement new universal listings design for document listing view (Sage Abdullah)
|
||||||
* Implement new universal listings design for site and locale listing views (Sage Abdullah)
|
* Implement new universal listings design for site and locale listing views (Sage Abdullah)
|
||||||
|
* Added `AbstractGroupApprovalTask` to simplify [customizing behavior of custom `Task` models](../extending/custom_tasks) (John-Scott Atlakson)
|
||||||
|
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
|
|
@ -3616,7 +3616,7 @@ class Workflow(AbstractWorkflow):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class GroupApprovalTask(Task):
|
class AbstractGroupApprovalTask(Task):
|
||||||
groups = models.ManyToManyField(
|
groups = models.ManyToManyField(
|
||||||
Group,
|
Group,
|
||||||
verbose_name=_("groups"),
|
verbose_name=_("groups"),
|
||||||
|
@ -3698,10 +3698,15 @@ class GroupApprovalTask(Task):
|
||||||
return _("Members of the chosen Wagtail Groups can approve this task")
|
return _("Members of the chosen Wagtail Groups can approve this task")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
abstract = True
|
||||||
verbose_name = _("Group approval task")
|
verbose_name = _("Group approval task")
|
||||||
verbose_name_plural = _("Group approval tasks")
|
verbose_name_plural = _("Group approval tasks")
|
||||||
|
|
||||||
|
|
||||||
|
class GroupApprovalTask(AbstractGroupApprovalTask):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class WorkflowStateQuerySet(models.QuerySet):
|
class WorkflowStateQuerySet(models.QuerySet):
|
||||||
def active(self):
|
def active(self):
|
||||||
"""
|
"""
|
||||||
|
|
Ładowanie…
Reference in New Issue