# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-11-11 19:11
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations


def add_animals_to_default(apps, schema_editor):
    Project = apps.get_model('annotation', 'Project')
    Animal = apps.get_model('annotation', 'Animal')
    db_alias = schema_editor.connection.alias
    try:
        fp_project = Project.objects.using(db_alias).get(pk=1)
        fp_project.animals = Animal.objects.using(db_alias).all()
        fp_project.save()
    except:
        pass


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('annotation', '0029_project_data_migration'),
    ]

    operations = [
        migrations.RunPython(add_animals_to_default),
    ]
