0008_auto_20151212_2313.py 1.95 KB
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('dictionary', '0007_auto_20151212_2218'),
        ('patterns', '0004_pattern'),
    ]

    state_operations = [
        migrations.RemoveField(
            model_name='pattern',
            name='type',
        ),
        migrations.DeleteModel(
            name='Pattern',
        ),
    ]

    def update_content_type(apps, schema_editor):
        ContentType = apps.get_model('contenttypes', 'ContentType')
        ContentType.objects.filter(
            app_label='patterns', model='pattern').delete()
        ct = ContentType.objects.get(app_label='dictionary', model='pattern')
        ct.app_label = 'patterns'
        ct.save()

    operations = [
        migrations.RunPython(update_content_type),
        migrations.AlterField(
            model_name='ending',
            name='pattern',
            field=models.ForeignKey(related_name='endings', db_column=b'w_id', to='patterns.Pattern'),
        ),
        migrations.AlterField(
            model_name='history',
            name='pattern',
            field=models.ForeignKey(db_column=b'pattern_id_', blank=True, to='patterns.Pattern', null=True),
        ),
        migrations.AlterField(
            model_name='lexeme',
            name='patterns',
            field=models.ManyToManyField(to='patterns.Pattern', through='dictionary.LexemeInflectionPattern'),
        ),
        migrations.AlterField(
            model_name='lexemeinflectionpattern',
            name='pattern',
            field=models.ForeignKey(db_column=b'w_id', verbose_name='pattern', to='patterns.Pattern'),
        ),
        migrations.AlterField(
            model_name='patternexample',
            name='pattern',
            field=models.ForeignKey(to='patterns.Pattern'),
        ),
        migrations.SeparateDatabaseAndState(state_operations=state_operations),
    ]