Python API¶
Helper functions for third-party code that needs to interact with
moderation — for example a custom admin, toolbar or REST endpoint that must
respect review locks. All functions live in
djangocms_moderation.helpers.
- is_registered_for_moderation(content_object)¶
Return
Trueif the content object’s model is registered for moderation via any app’smoderated_models(see App configuration (cms_config.py)).
- get_active_moderation_request(content_object)¶
Return the active
ModerationRequestfor the content object’s version, orNoneif there is none — meaning the object can be submitted for moderation.
- is_obj_review_locked(obj, user)¶
Return
Trueifobjis review-locked foruser, i.e. the user must not edit the version because it is part of an active moderation request. The lock is lifted for the author of a rejected request, who needs to edit the content in order to resubmit it (see Review locking).
- is_obj_version_unlocked(content_obj, user)¶
Return
Trueif the content object is not version-locked for the user. Takes djangocms-version-locking into account when that package is installed; without it, always returnsTrue.
- get_page_or_404(obj_id, language)¶
Return the
PageContentfor the given page id and language, or raiseHttp404.
Signals¶
For reacting to moderation events (submission, publication, unpublication) see Signals.