From 2189652ae9c9acdd268cf15e4accdd140053196e Mon Sep 17 00:00:00 2001 From: Christer Jensen Date: Wed, 17 May 2023 00:00:49 +0200 Subject: [PATCH] Update documentation for `log_action` parameter on `RevisionMixin.save_revision` Previous documentation seemed to incorrectly imply that the default value for `log_action` was `True` when it is in fact `False`. This can confuse readers not looking at the method signature. --- CONTRIBUTORS.rst | 1 + docs/releases/4.1.6.md | 4 ++++ docs/releases/4.2.4.md | 4 ++++ docs/releases/5.0.1.md | 4 ++++ docs/releases/5.1.md | 1 + wagtail/models/__init__.py | 2 +- 6 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index d23a8d0576..1fb265674e 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -709,6 +709,7 @@ Contributors * Swojak-A * fidoriel * Ramon Wenger +* Christer Jensen Translators =========== diff --git a/docs/releases/4.1.6.md b/docs/releases/4.1.6.md index b0ed4b58a8..1014f45635 100644 --- a/docs/releases/4.1.6.md +++ b/docs/releases/4.1.6.md @@ -15,3 +15,7 @@ depth: 1 * Rectify previous fix for TableBlock becoming uneditable after save (Sage Abdullah) * Ensure that copying page correctly picks up the latest revision (Matt Westcott) + +### Documentation + + * Update documentation for `log_action` parameter on `RevisionMixin.save_revision` (Christer Jensen) diff --git a/docs/releases/4.2.4.md b/docs/releases/4.2.4.md index 9e3f4f0007..06dd2db092 100644 --- a/docs/releases/4.2.4.md +++ b/docs/releases/4.2.4.md @@ -15,3 +15,7 @@ depth: 1 * Rectify previous fix for TableBlock becoming uneditable after save (Sage Abdullah) * Ensure that copying page correctly picks up the latest revision (Matt Westcott) + +### Documentation + + * Update documentation for `log_action` parameter on `RevisionMixin.save_revision` (Christer Jensen) diff --git a/docs/releases/5.0.1.md b/docs/releases/5.0.1.md index e102844b57..4d4001d079 100644 --- a/docs/releases/5.0.1.md +++ b/docs/releases/5.0.1.md @@ -15,3 +15,7 @@ depth: 1 * Rectify previous fix for TableBlock becoming uneditable after save (Sage Abdullah) * Ensure that copying page correctly picks up the latest revision (Matt Westcott) + +### Documentation + + * Update documentation for `log_action` parameter on `RevisionMixin.save_revision` (Christer Jensen) diff --git a/docs/releases/5.1.md b/docs/releases/5.1.md index 8762bc31d9..36902959bd 100644 --- a/docs/releases/5.1.md +++ b/docs/releases/5.1.md @@ -29,6 +29,7 @@ FieldPanels can now be marked as read-only with the `read_only=True` keyword arg * Document how to add non-ModelAdmin views to a `ModelAdminGroup` (Onno Timmerman) * Document how to add StructBlock data to a StreamField (Ramon Wenger) * Update ReadTheDocs settings to v2 to resolve urllib3 issue in linkcheck extension (Thibaud Colas) + * Update documentation for `log_action` parameter on `RevisionMixin.save_revision` (Christer Jensen) ### Maintenance diff --git a/wagtail/models/__init__.py b/wagtail/models/__init__.py index c862007918..8477a705d9 100644 --- a/wagtail/models/__init__.py +++ b/wagtail/models/__init__.py @@ -349,7 +349,7 @@ class RevisionMixin(models.Model): :param submitted_for_moderation: Indicates whether the object was submitted for moderation. :param approved_go_live_at: The date and time the revision is approved to go live. :param changed: Indicates whether there were any content changes. - :param log_action: Flag for logging the action. Pass ``False`` to skip logging. Can be passed an action string. + :param log_action: Flag for logging the action. Pass ``True`` to also create a log entry. Can be passed an action string. Defaults to ``"wagtail.edit"`` when no ``previous_revision`` param is passed, otherwise ``"wagtail.revert"``. :param previous_revision: Indicates a revision reversal. Should be set to the previous revision instance. :type previous_revision: Revision