I am using django-cms and their cms.api to migrate some articles from a WordPress site.
So far I have managed to:
import requests as req
from cms.api import create_page, add_plugin
from bs4 import BeautifulSoup as bs
from datetime import datetime
raw = req.get("site_base/article/").text
soup = bs(raw)
title = soup.find("title").text
slug = soup.find("meta", {"property":"og:url"})['content'].split("site_base")[1].\
replace("/","")
meta_desc = soup.find("meta", {"name": "description"})['content']
page = create_page(title, template='home.html', language='en', slug=slug, meta_description=meta_desc,
created_by='Sid', publication_date=datetime.now().date())
placeholder = page.placeholders.get(slot='content')
add_plugin(placeholder, 'TextPlugin', 'en', body='hello world')
I am trying to find a way to put the raw html of the body(I have the articles in html format, if that matters) as content. I have looked up all possible resources I could think of and nothing is working.
Django CMS plugin (specifically a TextPlugin in your case), you can use the djangocms-text-ckeditor