Signals#
The djangocms_moderation.signals module defines a set of signals sent by
Django CMS Moderation.
submitted_for_review#
- djangocms_moderation.submitted_for_review#
Sent when a Moderation Collection is submitted for review, or when select Moderation Requests are resubmitted after being rejected.
Arguments sent with this signal:
senderdjangocms_moderation.models.ModerationCollectionclasscollectionA
djangocms_moderation.models.ModerationCollectioninstance which was submitted for reviewmoderation_requestsA list of
djangocms_moderation.models.ModerationRequestinstances which were submitted for reviewNote
It’s possible for this list to contain only some of the requests belonging to the collection being moderated, because only some of the requests required rework.
This case is only possible for resubmitting after a rework.
userA
django.contrib.auth.models.Userinstance which triggered the submissionreworkA
boolvalue specifying if this was the first time the collection was submitted, or a rework of its moderation requests
published#
- djangocms_moderation.published#
Sent when a Moderation Collection is being published
Arguments sent with this signal:
senderdjangocms_moderation.models.ModerationCollectionclasscollectionA
djangocms_moderation.models.ModerationCollectioninstance which was submitted to be published.moderatorA
django.contrib.auth.models.Userassociated with the collection which is the moderator of the collection.moderation_requestsA list of
djangocms_moderation.models.ModerationRequestinstances which were published.Note
It’s possible for this list to contain only some of the requests belonging to the collection being moderated, because only some of the requests were published.
workflowAn instance of
djangocms_moderation.models.Workflowwhich was used for this collection.
unpublished#
- djangocms_moderation.unpublished#
Sent when a Moderation Collection is being unpublished
Arguments sent with this signal:
senderdjangocms_moderation.models.ModerationCollectionclasscollectionA
djangocms_moderation.models.ModerationCollectioninstance which was submitted to be unpublished.moderatorA
django.contrib.auth.models.Userassociated with the collection which is the moderator of the collection.moderation_requestsA list of
djangocms_moderation.models.ModerationRequestinstances which were unpublished.Note
It’s possible for this list to contain only some of the requests belonging to the collection being moderated, because only some of the requests were unpublished.
workflowAn instance of
djangocms_moderation.models.Workflowwhich was used for this collection.
How to use the moderation publish signal for a collection#
The CMS used to provide page publish and unpublish signals which have since been removed in DjangoCMS 4.0. You can instead use the signals provided above to replace these.
Djangocms-moderation provides a way to take further actions once a collection has been published. The published event is the last event executed for a moderation.
from django.dispatch import receiver
from cms.models import PageContent
from djangocm_moderation.signals import published
@receiver(published)
def do_something_on_publish_event(*args, **kwargs):
# all keyword arguments can be found in kwargs
# pass