mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Fixes #9729: Fix ordering of content type creation to ensure compatability with demo data
This commit is contained in:
parent
024e7d8651
commit
68b87dd668
@ -99,6 +99,7 @@ Custom field UI visibility has no impact on API operation.
|
||||
### Bug Fixes
|
||||
|
||||
* [#9728](https://github.com/netbox-community/netbox/issues/9728) - Fix validation when assigning a virtual machine to a device
|
||||
* [#9729](https://github.com/netbox-community/netbox/issues/9729) - Fix ordering of content type creation to ensure compatability with demo data
|
||||
|
||||
### Plugins API
|
||||
|
||||
|
@ -3,7 +3,6 @@ from django.db import migrations
|
||||
|
||||
def populate_cable_terminations(apps, schema_editor):
|
||||
Cable = apps.get_model('dcim', 'Cable')
|
||||
ContentType = apps.get_model('contenttypes', 'ContentType')
|
||||
|
||||
cable_termination_models = (
|
||||
apps.get_model('dcim', 'ConsolePort'),
|
||||
@ -18,12 +17,17 @@ def populate_cable_terminations(apps, schema_editor):
|
||||
)
|
||||
|
||||
for model in cable_termination_models:
|
||||
ct = ContentType.objects.get_for_model(model)
|
||||
model.objects.filter(
|
||||
id__in=Cable.objects.filter(termination_a_type=ct).values_list('termination_a_id', flat=True)
|
||||
id__in=Cable.objects.filter(
|
||||
termination_a_type__app_label=model._meta.app_label,
|
||||
termination_a_type__model=model._meta.model_name
|
||||
).values_list('termination_a_id', flat=True)
|
||||
).update(cable_end='A')
|
||||
model.objects.filter(
|
||||
id__in=Cable.objects.filter(termination_b_type=ct).values_list('termination_b_id', flat=True)
|
||||
id__in=Cable.objects.filter(
|
||||
termination_b_type__app_label=model._meta.app_label,
|
||||
termination_b_type__model=model._meta.model_name
|
||||
).values_list('termination_b_id', flat=True)
|
||||
).update(cable_end='B')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user