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