From 8daa8dd5f6f3d938b7d2e68d333495ba971d6b60 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Tue, 12 Jul 2016 22:11:50 +0200 Subject: [PATCH] Fixed compatibility error for 3.3 --- djangocms_blog/admin.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/djangocms_blog/admin.py b/djangocms_blog/admin.py index b849c2f..8d479e0 100755 --- a/djangocms_blog/admin.py +++ b/djangocms_blog/admin.py @@ -5,6 +5,7 @@ from copy import deepcopy from aldryn_apphooks_config.admin import BaseAppHookConfig, ModelAppHookConfig from cms.admin.placeholderadmin import FrontendEditableAdminMixin, PlaceholderAdminMixin +from cms.models import CMSPlugin from django import forms from django.apps import apps from django.conf import settings @@ -91,10 +92,17 @@ class PostAdmin(PlaceholderAdminMixin, FrontendEditableAdminMixin, urls.extend(super(PostAdmin, self).get_urls()) return urls - def post_add_plugin(self, request, placeholder, plugin): + def post_add_plugin(self, request, obj1, obj2=None): + if isinstance(obj1, CMSPlugin): + plugin = obj1 + elif isinstance(obj2, CMSPlugin): + plugin = obj2 if plugin.plugin_type in get_setting('LIVEBLOG_PLUGINS'): plugin = plugin.move(plugin.get_siblings().first(), 'first-sibling') - return super(PostAdmin, self).post_add_plugin(request, placeholder, plugin) + if isinstance(obj1, CMSPlugin): + return super(PostAdmin, self).post_add_plugin(request, plugin) + elif isinstance(obj2, CMSPlugin): + return super(PostAdmin, self).post_add_plugin(request, obj1, plugin) def publish_post(self, request, pk): """