<reponame>mouthwateringmedia/django-filer<filename>filer/migrations/0011_folder_polymorphic_ctype.py<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-20 14:53
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion


def forwards_func(apps, schema_editor):
    Folder = apps.get_model('filer', 'Folder')
    ContentType = apps.get_model('contenttypes', 'ContentType')

    new_ct = ContentType.objects.get_for_model(Folder)
    Folder.objects.filter(polymorphic_ctype__isnull=True).update(polymorphic_ctype=new_ct)


class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('filer', '0010_auto_20180414_2058'),
    ]

    operations = [
        migrations.AddField(
            model_name='folder',
            name='polymorphic_ctype',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='polymorphic_filer.folder_set+', to='contenttypes.ContentType'),
        ),
        migrations.RunPython(forwards_func, migrations.RunPython.noop),
    ]

# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-20 14:53
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion


def forwards_func(apps, schema_editor):
    Folder = apps.get_model('filer', 'Folder')
    ContentType = apps.get_model('contenttypes', 'ContentType')

    new_ct = ContentType.objects.get_for_model(Folder)
    Folder.objects.filter(polymorphic_ctype__isnull=True).update(polymorphic_ctype=new_ct)


class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('filer', '0010_auto_20180414_2058'),
    ]

    operations = [
        migrations.AddField(
            model_name='folder',
            name='polymorphic_ctype',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='polymorphic_filer.folder_set+', to='contenttypes.ContentType'),
        ),
        migrations.RunPython(forwards_func, migrations.RunPython.noop),
    ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.16 on 2018-11-20 14:53