mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-12 19:39:35 -06:00
22 lines
489 B
Python
22 lines
489 B
Python
# -*- coding: utf-8 -*-
|
|
# Generated by Django 1.10.4 on 2017-02-16 21:23
|
|
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),
|
|
]
|