# -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-12-16 15:03
from __future__ import unicode_literals

from django.db import migrations, models

from democracy.models import SectionComment


def forwards_func(apps, schema_editor):
    for comment in SectionComment.objects.all():
        comment._detect_lang()
        comment.save()


def backwards_func(apps, schema_editor):
    pass


class Migration(migrations.Migration):

    dependencies = [
        ('democracy', '0031_remove_untranslated_fields'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='sectionimage',
            options={'ordering': ('ordering', 'translations__title'), 'verbose_name': 'section image', 'verbose_name_plural': 'section images'},
        ),
        migrations.AddField(
            model_name='sectioncomment',
            name='language_code',
            field=models.CharField(blank=True, max_length=15, verbose_name='language code'),
        ),
        migrations.RunPython(forwards_func, backwards_func),
    ]

# -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-12-16 15:03
from __future__ import unicode_literals

from django.db import migrations, models

from democracy.models import SectionComment


def forwards_func(apps, schema_editor):
    for comment in SectionComment.objects.all():
        comment._detect_lang()
        comment.save()


def backwards_func(apps, schema_editor):
    pass


class Migration(migrations.Migration):

    dependencies = [
        ('democracy', '0031_remove_untranslated_fields'),
        # comment.save() database operations will require a recent user model with all the fields included
        ('kerrokantasi', '__latest__'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='sectionimage',
            options={'ordering': ('ordering', 'translations__title'), 'verbose_name': 'section image', 'verbose_name_plural': 'section images'},
        ),
        migrations.AddField(
            model_name='sectioncomment',
            name='language_code',
            field=models.CharField(blank=True, max_length=15, verbose_name='language code'),
        ),
        migrations.RunPython(forwards_func, backwards_func),
    ]

Add literal dependency so migration 0031 won't fail if run in the wrong order