-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from networktocode/mzb-develop-fix-93
Fix Issue #93
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
netbox_onboarding/migrations/0004_create_onboardingdevice.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,20 @@ | ||
from django.db import migrations | ||
|
||
|
||
def create_missing_onboardingdevice(apps, schema_editor): | ||
Device = apps.get_model("dcim", "Device") | ||
OnboardingDevice = apps.get_model("netbox_onboarding", "OnboardingDevice") | ||
|
||
for device in Device.objects.filter(onboardingdevice__isnull=True): | ||
OnboardingDevice.objects.create(device=device) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("netbox_onboarding", "0003_onboardingtask_change_logging_model"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(create_missing_onboardingdevice), | ||
] |
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