8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 07:23:46 +00:00

Fix initial migration

This commit is contained in:
Hugo Levy-Falk 2019-09-05 17:56:35 +02:00 committed by root
parent ffde9f1a98
commit 8d4aac1e49

View file

@ -16,12 +16,12 @@ class Migration(migrations.Migration):
machinetype = apps.get_model("machines", "MachineType")
borne = apps.get_model("topologie", "Borne")
interface = apps.get_model("machines", "Interface")
bornes_list = machinetype.objects.using(db_alias).filter(type__icontains='borne')
bornes_list = machinetype.objects.using(db_alias).filter(ip_type__name__icontains='borne')
if bornes_list:
for inter in interface.objects.using(db_alias).filter(type=bornes_list.first()):
for inter in interface.objects.using(db_alias).filter(machine_type=bornes_list.first()):
borne_object = borne()
borne_object.interface_ptr_id = inter.pk
borne_object.__dict__.update(inter.__dict__)
borne_object.__dict__.update(inter.__dict__)
borne_object.save()
def untransfer_bornes(apps, schema_editor):