camp/content/migrations/0013_related.py

24 lines
548 B
Python
Raw Normal View History

2018-08-22 19:59:40 +00:00
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-08-22 19:08
from __future__ import unicode_literals
from django.db import migrations
def migrate_relations(apps, schema_editor):
Content = apps.get_model("content", "Content")
for c in Content.objects.all():
for r in c.parents.all():
c.related_content.add(r)
class Migration(migrations.Migration):
dependencies = [
('content', '0012_content_related_content'),
]
operations = [
migrations.RunPython(migrate_relations),
]