From 8468fc7e3f36b32c8146fe5050a5715f12907b4d Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Tue, 7 May 2024 16:21:34 +0200 Subject: [PATCH] =?UTF-8?q?I=20=E2=9D=A4=EF=B8=8F=20migration=200044:=20It?= =?UTF-8?q?=20happens=20right=20in=20the=20middle=20between=20v3=20and=20v?= =?UTF-8?q?4=20principles=20...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- djangocms_blog/migrations/0044_copy_plugins.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/djangocms_blog/migrations/0044_copy_plugins.py b/djangocms_blog/migrations/0044_copy_plugins.py index 28a3fbcd..6d1cb383 100644 --- a/djangocms_blog/migrations/0044_copy_plugins.py +++ b/djangocms_blog/migrations/0044_copy_plugins.py @@ -48,24 +48,20 @@ def move_plugins_to_blog_content(apps, schema_editor): translation.delete() # Resolve placeholders - post_media = get_placeholder_from_slot(post.placeholders, "media") - post_content = get_placeholder_from_slot(post.placeholders, "content") - post_liveblog = get_placeholder_from_slot(post.placeholders, "liveblog") - content_media = get_placeholder_from_slot(content.placeholders, "media") content_content = get_placeholder_from_slot(content.placeholders, "content") content_liveblog = get_placeholder_from_slot(content.placeholders, "liveblog") # Move plugins to post content placeholders - if post_media: - media_plugins = post_media.cmsplugin_set.filter(language=translation.language_code) + if post.media: + media_plugins = post.media.cmsplugin_set.filter(language=translation.language_code) media_plugins.update(placeholder=content_media) - if post_content: + if post.content: print("Moving content plugins...") - content_plugins = post_content.cmsplugin_set.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 = post_liveblog.cmsplugin_set.filter(language=translation.language_code) + if post.liveblog: + live_plugins = post.liveblog.cmsplugin_set.filter(language=translation.language_code) live_plugins.update(placeholder=content_liveblog)