Skip to content

Commit

Permalink
fix migration 0044 even more
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed May 6, 2024
1 parent 9063aee commit f087119
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions djangocms_blog/migrations/0044_copy_plugins.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from django.contrib.auth import get_user_model
from django.db import migrations

from cms.models import Placeholder as CurrentPlaceholderModel

User = get_user_model()


Expand Down Expand Up @@ -49,20 +47,14 @@ def move_plugins_to_blog_content(apps, schema_editor):
translation.delete()
# Move plugins to post content placeholders
if post.media:
media_plugins = (CurrentPlaceholderModel
.get_plugins(post.media)
.filter(language=translation.language_code))
media_plugins = post.media.cmsplugin_set.filter(language=translation.language_code)
media_plugins.update(placeholder=content.media)
if post.content:
print("Moving content plugins...")
content_plugins = (CurrentPlaceholderModel
.get_plugins(post.content)
.filter(language=translation.language_code))
content_plugins = post.content.cmsplugin_set.filter(language=translation.language_code)
content_plugins.update(placeholder=content.content)
if post.liveblog:
live_plugins = (CurrentPlaceholderModel
.get_plugins(post.liveblog)
.filter(language=translation.language_code))
live_plugins = post.liveblog.cmsplugin_set.filter(language=translation.language_code)
live_plugins.update(placeholder=content.liveblog)


Expand Down

0 comments on commit f087119

Please sign in to comment.