This repository has been archived by the owner on Jun 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
178 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Generated by Django 2.2.9 on 2019-12-21 18:51 | ||
|
||
from django.db import migrations, models | ||
import sortedm2m.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('django_netjsongraph', '0007_link_status_changed'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Address', | ||
fields=[ | ||
('address', models.GenericIPAddressField(primary_key=True, serialize=False)), | ||
], | ||
), | ||
migrations.RenameField( | ||
model_name='node', | ||
old_name='addresses', | ||
new_name='addresses_old', | ||
), | ||
migrations.AddField( | ||
model_name='node', | ||
name='addresses', | ||
field=sortedm2m.fields.SortedManyToManyField(help_text=None, to='django_netjsongraph.Address'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 2.2.9 on 2019-12-30 07:29 | ||
|
||
from django.db import migrations | ||
|
||
def link_nodes(apps, schema_editor): | ||
Node = apps.get_model('django_netjsongraph', 'Node') | ||
Address = apps.get_model('django_netjsongraph', 'Address') | ||
for node in Node.objects.all(): | ||
addresses = node.addresses_old.replace(' ', '') | ||
if addresses.startswith(';'): | ||
addresses = addresses[1:] | ||
addresses = addresses[0:-1].split(';') | ||
for address in addresses: | ||
address, created = Address.objects.get_or_create(address=address) | ||
node.addresses.add(address) | ||
node.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('django_netjsongraph', '0008_node_address_link'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(link_nodes) | ||
] |
18 changes: 18 additions & 0 deletions
18
django_netjsongraph/migrations/0010_rename_node_addresses.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 2.2.9 on 2019-12-30 07:45 | ||
|
||
from django.db import migrations | ||
import sortedm2m.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('django_netjsongraph', '0009_transfer_addresses'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='node', | ||
name='addresses_old', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.