2018-03-26 01:09:42 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Generated by Django 1.10.7 on 2018-03-23 01:18
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.db import migrations, models
|
|
|
|
import django.db.models.deletion
|
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
2019-11-04 16:55:03 +00:00
|
|
|
dependencies = [("topologie", "0047_ap_machine")]
|
2018-03-26 01:09:42 +00:00
|
|
|
|
|
|
|
def transfer_ap(apps, schema_editor):
|
|
|
|
db_alias = schema_editor.connection.alias
|
|
|
|
ap = apps.get_model("topologie", "AccessPoint")
|
|
|
|
new_ap = apps.get_model("topologie", "NewAccessPoint")
|
|
|
|
ap_list = ap.objects.using(db_alias).all()
|
|
|
|
for borne in ap_list:
|
|
|
|
new_borne = new_ap()
|
|
|
|
new_borne.machine_ptr_id = borne.machine.pk
|
|
|
|
new_borne.__dict__.update(borne.machine.__dict__)
|
|
|
|
new_borne.location = borne.location
|
|
|
|
new_borne.save()
|
|
|
|
|
|
|
|
def untransfer_ap(apps, schema_editor):
|
|
|
|
return
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.RunPython(transfer_ap, untransfer_ap),
|
2019-11-04 16:55:03 +00:00
|
|
|
migrations.DeleteModel(name="AccessPoint"),
|
|
|
|
migrations.RenameModel(old_name="NewAccessPoint", new_name="AccessPoint"),
|
2018-03-26 01:09:42 +00:00
|
|
|
]
|