mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-20 10:23:12 +00:00
c4a104b3b6
Just ran black on the whoe repository. Fix #210.
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
# -*- 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):
|
|
|
|
dependencies = [("topologie", "0047_ap_machine")]
|
|
|
|
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),
|
|
migrations.DeleteModel(name="AccessPoint"),
|
|
migrations.RenameModel(old_name="NewAccessPoint", new_name="AccessPoint"),
|
|
]
|