def bulk_create_posts(self, posts, post_categories, post_tags, post_media_attachments):
        """
        Actually do a db bulk creation of posts, and link up the many-to-many fields

        :param posts: the list of Post objects to bulk create
        :param post_categories: a mapping of Categories to add to newly created Posts
        :param post_tags: a mapping of Tags to add to newly created Posts
        :param post_media_attachments: a mapping of Medias to add to newly created Posts
        :return: None
        """
        Post.objects.bulk_create(posts)

        # attach many-to-ones
        for post_wp_id, categories in six.iteritems(post_categories):
            Post.objects.get(site_id=self.site_id, wp_id=post_wp_id).categories.add(*categories)

        for post_id, tags in six.iteritems(post_tags):
            Post.objects.get(site_id=self.site_id, wp_id=post_id).tags.add(*tags)

        for post_id, attachments in six.iteritems(post_media_attachments):
            Post.objects.get(site_id=self.site_id, wp_id=post_id).attachments.add(*attachments)
def bulk_create_posts ( self , posts , post_categories , post_tags , post_media_attachments ) : Post . objects . bulk_create ( posts ) for post_wp_id , categories in six . iteritems ( post_categories ) : Post . objects . get ( site_id = self . site_id , wp_id = post_wp_id ) . categories . add ( * categories ) for post_id , tags in six . iteritems ( post_tags ) : Post . objects . get ( site_id = self . site_id , wp_id = post_id ) . tags . add ( * tags ) for post_id , attachments in six . iteritems ( post_media_attachments ) : Post . objects . get ( site_id = self . site_id , wp_id = post_id ) . attachments . add ( * attachments )
Actually do a db bulk creation of posts, and link up the many-to-many fields

        :param posts: the list of Post objects to bulk create
        :param post_categories: a mapping of Categories to add to newly created Posts
        :param post_tags: a mapping of Tags to add to newly created Posts
        :param post_media_attachments: a mapping of Medias to add to newly created Posts
        :return: None