8000 fix: Menus crashed when unexpected page content was present by fsbraun · Pull Request #8052 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

fix: Menus crashed when unexpected page content was present #8052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Nov 4, 2024
Prev Previous commit
Next Next commit
Undo unwanted changes to placeholdermodel.py
  • Loading branch information
fsbraun authored Oct 31, 2024
commit a1c1c5ab20a827a93810c02ff1cd9d31f9b2db46
7 changes: 2 additions & 5 deletions cms/models/placeholdermodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ def delete_plugin(self, instance):
self._shift_plugin_positions(
instance.language,
start=instance.position,
offset=last_plugin.position + 1,
offset=last_plugin.position,
)
self._recalculate_plugin_positions(instance.language)

Expand Down Expand Up @@ -740,10 +740,7 @@ def get_last_plugin_position(self, language, parent=None):

def _shift_plugin_positions(self, language, start, offset=None):
if offset is None:
offset = self.get_last_plugin_position(language)
if offset is None:
return
offset += 1
offset = self.get_last_plugin_position(language) or 0
self.get_plugins(language).filter(
position__gte=start
).update(position=models.F('position') + offset)
Expand Down
Loading
0