1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Rename content_type_identifier() and content_type_name()

This commit is contained in:
Jeremy Stretch
2024-03-21 14:44:59 -04:00
parent ae8df77cc8
commit 8ad73e3f90
10 changed files with 38 additions and 37 deletions

View File

@@ -13,7 +13,7 @@ from taggit.managers import TaggableManager
from core.models import ObjectType
from users.models import ObjectPermission
from utilities.permissions import resolve_permission_type
from utilities.utils import content_type_identifier
from utilities.utils import object_type_identifier
from .utils import extract_form_failures
__all__ = (
@@ -114,7 +114,7 @@ class ModelTestCase(TestCase):
if value and type(field) in (ManyToManyField, TaggableManager):
if field.related_model in (ContentType, ObjectType) and api:
model_dict[key] = sorted([content_type_identifier(ct) for ct in value])
model_dict[key] = sorted([object_type_identifier(ot) for ot in value])
else:
model_dict[key] = sorted([obj.pk for obj in value])
@@ -122,8 +122,8 @@ class ModelTestCase(TestCase):
# Replace ContentType numeric IDs with <app_label>.<model>
if type(getattr(instance, key)) in (ContentType, ObjectType):
ct = ObjectType.objects.get(pk=value)
model_dict[key] = content_type_identifier(ct)
object_type = ObjectType.objects.get(pk=value)
model_dict[key] = object_type_identifier(object_type)
# Convert IPNetwork instances to strings
elif type(value) is IPNetwork: