# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-02-06 09:55


from django.db import migrations


def datamigrate_update_for_no_none_values_in_feedbackset_deadline(apps, schema_editor):
    feedback_set_model = apps.get_model('devilry_group', 'FeedbackSet')

    for feedback_set in feedback_set_model.objects.filter(feedbackset_type='first_attempt'):
        feedback_set.deadline_datetime = feedback_set.group.parentnode.first_deadline
        feedback_set.save()


class Migration(migrations.Migration):

    dependencies = [
        ('devilry_group', '0025_auto_20170124_1504'),
    ]

    operations = [
        migrations.RunPython(datamigrate_update_for_no_none_values_in_feedbackset_deadline)
    ]
