2018-03-25 02:05:26 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Generated by Django 1.10.7 on 2017-12-31 19:53
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
2019-11-04 16:55:03 +00:00
|
|
|
dependencies = [("topologie", "0039_port_new_switch")]
|
2018-03-25 02:05:26 +00:00
|
|
|
|
|
|
|
def transfer_port(apps, schema_editor):
|
|
|
|
db_alias = schema_editor.connection.alias
|
|
|
|
port = apps.get_model("topologie", "Port")
|
|
|
|
switch = apps.get_model("topologie", "NewSwitch")
|
|
|
|
port_list = port.objects.using(db_alias).all()
|
|
|
|
for p in port_list:
|
2019-11-04 16:55:03 +00:00
|
|
|
p.new_switch = switch.objects.filter(
|
|
|
|
interface_ptr=p.switch.switch_interface
|
|
|
|
).first()
|
2018-03-25 02:05:26 +00:00
|
|
|
p.save()
|
|
|
|
|
|
|
|
def untransfer_port(apps, schema_editor):
|
|
|
|
return
|
|
|
|
|
2019-11-04 16:55:03 +00:00
|
|
|
operations = [migrations.RunPython(transfer_port, untransfer_port)]
|