Skip to content

Commit

Permalink
fix: For headless mode, django CMS 5.0 adds preview buttons to all vi…
Browse files Browse the repository at this point in the history
…ews. 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]>
  • Loading branch information
fsbraun and vinitkumar authored Mar 5, 2025
1 parent bf89036 commit fee0650
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion djangocms_versioning/cms_toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

VERSIONING_MENU_IDENTIFIER = "version"
CMS_SUPPORTS_DELETING_TRANSLATIONS = version.Version(cms_version) > version.Version("4.1.4")
CMS_ADDS_PREVIEW_BUTTON = version.Version(cms_version) >= version.Version("4.2")


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

if not self.toolbar.preview_mode_active and not self.toolbar.edit_mode_active:
Expand Down

0 comments on commit fee0650

Please sign in to comment.