We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8bc7508 commit e77308cCopy full SHA for e77308c
django_features/custom_fields/factories.py
@@ -3,7 +3,6 @@
3
from factory import SubFactory # type: ignore
4
from factory.django import DjangoModelFactory
5
6
-from app.models import Person
7
from django_features.custom_fields import models
8
9
@@ -12,8 +11,13 @@ class Meta:
12
11
model = models.CustomField
13
14
@lazy_attribute
15
- def content_type(self) -> ContentType:
16
- return ContentType.objects.get_for_model(Person)
+ def content_type(self) -> ContentType | None:
+ try:
+ from app.models import Person
17
+
18
+ return ContentType.objects.get_for_model(Person)
19
+ except ModuleNotFoundError:
20
+ return None
21
22
field_type = models.CustomField.FIELD_TYPES.CHAR
23
identifier = "custom_field"
0 commit comments