Revision e9b5ecff snf-cyclades-app/synnefo/db/migrations/0080_nics_to_ips.py
b/snf-cyclades-app/synnefo/db/migrations/0080_nics_to_ips.py | ||
---|---|---|
11 | 11 |
# Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..." |
12 | 12 |
# Delete stale NICs |
13 | 13 |
orm.NetworkInterface.objects.filter(machine__deleted=True).delete() |
14 |
for nic in orm.NetworkInterface.objects.all(): |
|
14 |
for nic in orm.NetworkInterface.objects.select_related('machine', |
|
15 |
'network').all(): |
|
15 | 16 |
userid = nic.machine.userid |
16 | 17 |
nic.userid = userid |
17 | 18 |
nic.save() |
Also available in: Unified diff