# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-16 21:23
from __future__ import unicode_literals

from django.db import migrations


def copy_site_from_rack(apps, schema_editor):
    Device = apps.get_model('dcim', 'Device')
    for device in Device.objects.all():
        device.site = device.rack.site
        device.save()


class Migration(migrations.Migration):

    dependencies = [
        ('dcim', '0027_device_add_site'),
    ]

    operations = [
        migrations.RunPython(copy_site_from_rack),
    ]
