# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-09-28 11:23
from __future__ import unicode_literals

from django.db import migrations


def set_question_optionset(apps, schema_editor):
    Question = apps.get_model('questions', 'Question')

    for question in Question.objects.all():
        try:
            for optionset in question.attribute_entity.attribute.optionsets.all():
                question.optionsets.add(optionset)

        except AttributeError:
            pass


class Migration(migrations.Migration):

    dependencies = [
        ('questions', '0017_question_optionsets'),
    ]

    operations = [
        migrations.RunPython(set_question_optionset),
    ]
