|
@@ -10,6 +10,7 @@ from taggit.managers import TaggableManager
|
|
|
|
|
|
|
|
from users.models import ObjectPermission
|
|
from users.models import ObjectPermission
|
|
|
from utilities.permissions import resolve_permission_ct
|
|
from utilities.permissions import resolve_permission_ct
|
|
|
|
|
+from utilities.utils import content_type_identifier
|
|
|
from .utils import extract_form_failures
|
|
from .utils import extract_form_failures
|
|
|
|
|
|
|
|
__all__ = (
|
|
__all__ = (
|
|
@@ -110,7 +111,7 @@ class ModelTestCase(TestCase):
|
|
|
if value and type(field) in (ManyToManyField, TaggableManager):
|
|
if value and type(field) in (ManyToManyField, TaggableManager):
|
|
|
|
|
|
|
|
if field.related_model is ContentType and api:
|
|
if field.related_model is ContentType and api:
|
|
|
- model_dict[key] = sorted([f'{ct.app_label}.{ct.model}' for ct in value])
|
|
|
|
|
|
|
+ model_dict[key] = sorted([content_type_identifier(ct) for ct in value])
|
|
|
else:
|
|
else:
|
|
|
model_dict[key] = sorted([obj.pk for obj in value])
|
|
model_dict[key] = sorted([obj.pk for obj in value])
|
|
|
|
|
|
|
@@ -119,7 +120,7 @@ class ModelTestCase(TestCase):
|
|
|
# Replace ContentType numeric IDs with <app_label>.<model>
|
|
# Replace ContentType numeric IDs with <app_label>.<model>
|
|
|
if type(getattr(instance, key)) is ContentType:
|
|
if type(getattr(instance, key)) is ContentType:
|
|
|
ct = ContentType.objects.get(pk=value)
|
|
ct = ContentType.objects.get(pk=value)
|
|
|
- model_dict[key] = f'{ct.app_label}.{ct.model}'
|
|
|
|
|
|
|
+ model_dict[key] = content_type_identifier(ct)
|
|
|
|
|
|
|
|
# Convert IPNetwork instances to strings
|
|
# Convert IPNetwork instances to strings
|
|
|
elif type(value) is IPNetwork:
|
|
elif type(value) is IPNetwork:
|