jeremystretch 4 лет назад
Родитель
Сommit
85359bb10f
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      netbox/ipam/migrations/0046_set_vlangroup_scope_types.py

+ 2 - 2
netbox/ipam/migrations/0046_set_vlangroup_scope_types.py

@@ -6,11 +6,11 @@ def set_scope_types(apps, schema_editor):
     Set 'site' as the scope type for all VLANGroups with a scope ID defined.
     Set 'site' as the scope type for all VLANGroups with a scope ID defined.
     """
     """
     ContentType = apps.get_model('contenttypes', 'ContentType')
     ContentType = apps.get_model('contenttypes', 'ContentType')
+    Site = apps.get_model('dcim', 'Site')
     VLANGroup = apps.get_model('ipam', 'VLANGroup')
     VLANGroup = apps.get_model('ipam', 'VLANGroup')
 
 
-    site_ct = ContentType.objects.get(app_label='dcim', model='site').pk
     VLANGroup.objects.filter(scope_id__isnull=False).update(
     VLANGroup.objects.filter(scope_id__isnull=False).update(
-        scope_type=site_ct
+        scope_type=ContentType.objects.get_for_model(Site)
     )
     )