Explorar o código

Fix ContentType assignment

jeremystretch %!s(int64=4) %!d(string=hai) anos
pai
achega
85359bb10f
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  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.
     """
     ContentType = apps.get_model('contenttypes', 'ContentType')
+    Site = apps.get_model('dcim', 'Site')
     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(
-        scope_type=site_ct
+        scope_type=ContentType.objects.get_for_model(Site)
     )