Before 3 it was possible to import relay without django.contrib.contenttypes in INSTALLED_APPS, now it is a hard dependency because the optimizer is imported
It would be nice to have it only optionally as not everyone is using it.
I would recommend an RUNTIME_ERROR catch on import and conditionally remove the feature
File "/home/alex/git/graphene-protector/tests/teststrawberry_django.py", line 11, in <module>
from .django.schema_strawberry_plus import Query as QueryPlus
File "/home/alex/git/graphene-protector/tests/django/schema_strawberry_plus.py", line 6, in <module>
from strawberry_django_plus import relay
File "/home/alex/git/graphene-protector/.venv/lib/python3.11/site-packages/strawberry_django_plus/relay.py", line 14, in <module>
from .field import field
File "/home/alex/git/graphene-protector/.venv/lib/python3.11/site-packages/strawberry_django_plus/field.py", line 56, in <module>
from . import optimizer
File "/home/alex/git/graphene-protector/.venv/lib/python3.11/site-packages/strawberry_django_plus/optimizer.py", line 21, in <module>
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
File "/home/alex/git/graphene-protector/.venv/lib/python3.11/site-packages/django/contrib/contenttypes/fields.py", line 7, in <module>
from django.contrib.contenttypes.models import ContentType
File "/home/alex/git/graphene-protector/.venv/lib/python3.11/site-packages/django/contrib/contenttypes/models.py", line 139, in <module>
class ContentType(models.Model):
File "/home/alex/git/graphene-protector/.venv/lib/python3.11/site-packages/django/db/models/base.py", line 134, in __new__
raise RuntimeError(
RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Before 3 it was possible to import relay without django.contrib.contenttypes in
INSTALLED_APPS
, now it is a hard dependency because the optimizer is importedIt would be nice to have it only optionally as not everyone is using it.
I would recommend an RUNTIME_ERROR catch on import and conditionally remove the feature