Skip to content

Commit 530c5b1

Browse files
committed
fix: For headless mode, django CMS 4.2 adds preview buttons to all views. Do not add again.
1 parent f68190c commit 530c5b1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

djangocms_versioning/cms_toolbars.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
VERSIONING_MENU_IDENTIFIER = "version"
3939
CMS_SUPPORTS_DELETING_TRANSLATIONS = version.Version(cms_version) > version.Version("4.1.4")
40+
CMS_ADDS_PREVIEW_BUTTON = version.Version(cms_version) >= version.Version("4.2")
4041

4142

4243
class VersioningToolbar(PlaceholderToolbar):
@@ -270,7 +271,7 @@ def _add_view_published_button(self):
270271
def _add_preview_button(self):
271272
"""Helper method to add a preview button to the toolbar when not in preview mode"""
272273
# Check if object is registered with versioning otherwise don't add
273-
if not self._is_versioned():
274+
if not self._is_versioned() or CMS_ADDS_PREVIEW_BUTTON:
274275
return
275276

276277
if not self.toolbar.preview_mode_active and not self.toolbar.edit_mode_active:

0 commit comments

Comments
 (0)