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)