

def migrate_tags_reverse(apps, schema_editor):
    LatestPostsPlugin = apps.get_model('djangocms_blog', 'LatestPostsPlugin')
    Tag = apps.get_model('taggit', 'Tag')
    TaggedItem = apps.get_model('taggit', 'TaggedItem')
    plugin_content_type = ContentType.objects.get_for_model(LatestPostsPlugin)
    for tagged in TaggedItem.objects.filter(content_type_id=plugin_content_type.pk):
        post = LatestPostsPlugin.objects.get(pk=tagged.object_id)
        post.tags.add(tagged.tag)
        LatestPostsPlugin.delete()

dataset/ETHPy150Open nephila/djangocms-blog/djangocms_blog/migrations/0009_latestpostsplugin_tags_new.py migrate_tags_reverse/VarMisuse@100/160 `tagged`->`LatestPostsPlugin`