Skip to content

Commit fee0650

Browse files
fsbraunvinitkumar
andauthored
fix: For headless mode, django CMS 5.0 adds preview buttons to all views. Do not add again. (#455)
* fix: For headless mode, django CMS 4.2 adds preview buttons to all views. Do not add again. * fix: sqlite build on django main Latest Django main will only support Python3.12+, so 3.11 won't work --------- Co-authored-by: Vinit kumar <[email protected]>
1 parent bf89036 commit fee0650

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
@@ -38,6 +38,7 @@
3838

3939
VERSIONING_MENU_IDENTIFIER = "version"
4040
CMS_SUPPORTS_DELETING_TRANSLATIONS = version.Version(cms_version) > version.Version("4.1.4")
41+
CMS_ADDS_PREVIEW_BUTTON = version.Version(cms_version) >= version.Version("4.2")
4142

4243

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

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

0 commit comments

Comments
 (0)