tag:blogger.com,1999:blog-8227451082901531762.post6723189604361886337..comments2024-03-27T09:55:46.072+02:00Comments on Programmer blog: [Django CMS] Adding plugins inside plugins programaticallygarmoncheghttp://www.blogger.com/profile/01374837358090129603noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-8227451082901531762.post-24123100120659711622018-03-18T11:54:16.140+02:002018-03-18T11:54:16.140+02:00djangocms' add_plugin does not support a numbe...djangocms' add_plugin does not support a number for the position parameter. You have to set the created plugin's position property afterwards if you care about its position in the placeholder.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8227451082901531762.post-58084887495339144892016-04-08T00:15:11.165+03:002016-04-08T00:15:11.165+03:00I know it has been a long time, but this post has ...I know it has been a long time, but this post has been the only thing I found that helped me create plugins programmatically. I'd like to point that for the links inside text plugin (and for that matter, any other plugin inside the text plugin) can be inserted using the function plugin_to_tag inside package djangocms_text_ckeditor.utils.<br /><br />An example would be:<br /><br /> text = Text(<br /> placeholder=placeholder,<br /> language=lang,<br /> position=position,<br /> plugin_type=u'TextPlugin',<br /> parent=lightbox_gallery<br /> )<br /> text.save()<br /><br /> icon = Boostrap3IconPlugin(<br /> icon=fa_icon.attrs.get('class')[1],<br /> placeholder=placeholder,<br /> language=lang,<br /> position=position,<br /> plugin_type=u'Bootstrap3IconCMSPlugin',<br /> parent=text<br /> )<br /> icon.save()<br /><br /> text.body = '< ' + 'p' + '>' + gallery.get_text() + plugin_to_tag(icon) + ''<br /> text.save()<br /><br />I think this simplifies the above code because there's no need to make workarounds to include plugins inside the text plugin :)Laura Cristinahttps://www.blogger.com/profile/16514824583917931696noreply@blogger.comtag:blogger.com,1999:blog-8227451082901531762.post-27788086379537455112015-08-09T06:52:58.995+03:002015-08-09T06:52:58.995+03:00Thanks, a very helpful article. When can we expect...Thanks, a very helpful article. When can we expect part 2?Anonymousnoreply@blogger.com