# Generated by Django 2.2.8 on 2020-02-11 16:00

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

def fill_text_en(apps, schema_editor):
    Model = apps.get_model('projects', 'questionprototype')
    for index, row in enumerate(Model.objects.all()):
        row.text_en = str(index)
        row.save(update_fields=['text_en'])

class Migration(migrations.Migration):

    dependencies = [
        ('projects', '0011_auto_20200209_1840_squashed_0012_auto_20200209_1845'),
    ]

    operations = [
        migrations.RenameField(
            model_name='questionprototype',
            old_name='text',
            new_name='text_bg',
        ),
        migrations.RemoveField(
            model_name='answer',
            name='comment',
        ),
        migrations.RemoveField(
            model_name='answer',
            name='project',
        ),
        migrations.RemoveField(
            model_name='answer',
            name='status',
        ),
        migrations.RemoveField(
            model_name='answer',
            name='status_since',
        ),
        migrations.RemoveField(
            model_name='answer',
            name='user',
        ),
        migrations.AddField(
            model_name='questionprototype',
            name='required',
            field=models.BooleanField(default=True),
        ),
        migrations.AddField(
            model_name='questionprototype',
            name='text_en',
            field=models.CharField(default='', max_length=100, null=True),
            preserve_default=False,
        ),
        migrations.RunPython(fill_text_en,
            reverse_code=migrations.RunPython.noop
        ),
        migrations.AlterField(
            model_name='questionprototype',
            name='text_en',
            field=models.CharField(default='', max_length=100, null=False, unique=True),
            preserve_default=False,
        ),

        migrations.AlterField(
            model_name='answer',
            name='answer',
            field=models.TextField(blank=True),
        ),
        migrations.AlterField(
            model_name='answer',
            name='time_support',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='projects.TimeSupport'),
        ),
        migrations.AlterField(
            model_name='questionprototype',
            name='type',
            field=models.CharField(choices=[('CharField', 'CharField'), ('TextField', 'TextField'), ('FileField', 'FileField'), ('ChoiceField', 'ChoiceField'), ('Necessities', 'Necessities')], max_length=20),
        ),
    ]
