3đź‘Ť
Had more luck with cms.api.add_plugin
. Funny thing is I couldn’t get the position to stick. I think it expects wafty “last-child”-style English rather than a numerical input. So I just nail it in a second time after add_plugin
.
from cms import api
for v in FilerVideo.objects.all():
youtube_id = re.search(r'v=([^&]+)', v.movie_url).groups(0)[0]
position = v.position
v.delete()
new = api.add_plugin(v.placeholder, 'YoutubePlugin', v.language, position, v.parent, youtube_id=youtube_id, thumbnail=v.image)
new.position = position
new.save()
👤Oli
Source:stackexchange.com