summaryrefslogtreecommitdiff
path: root/app/posts/importer.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/posts/importer.py')
-rw-r--r--app/posts/importer.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/posts/importer.py b/app/posts/importer.py
new file mode 100644
index 0000000..53a84aa
--- /dev/null
+++ b/app/posts/importer.py
@@ -0,0 +1,29 @@
+for e in essaysold:
+ if e.featured_image:
+ feat = e.featured_image
+ else:
+ feat = None
+ if e.meta_description:
+ meta = e.meta_description
+ else:
+ meta = "need meta"
+ new, created = Post.objects.get_or_create(
+ old_id=e.pk,
+ post_type=2,
+ title=e.title,
+ subtitle=e.sub_title,
+ dek=e.dek,
+ slug=e.slug,
+ prologue_markdown=e.preamble,
+ body_markdown=e.body_markdown,
+ pub_date=e.pub_date,
+ enable_comments=e.enable_comments,
+ status=e.status,
+ meta_description=meta,
+ originally_published_by=e.originally_published_by,
+ originally_published_by_url=e.originally_published_by_url,
+ featured_image=feat,
+ has_video=e.has_video,
+ epilogue_markdown=e.afterword,
+ )
+ print(created)