Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update graphene-django-extras to work with Django 4.0 #181

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions graphene_django_extras/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
GenericRel,
)
from django.db import models
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from graphene import (
Field,
ID,
Expand Down Expand Up @@ -52,7 +52,7 @@ def assert_valid_name(name):


def convert_choice_name(name):
name = to_const(force_text(name))
name = to_const(force_str(name))
try:
assert_valid_name(name)
except AssertionError:
Expand Down
5 changes: 5 additions & 0 deletions graphene_django_extras/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ def __init_subclass_with_meta__(
'You need to pass a valid Django Model in {}.Meta, received "{}".'
).format(cls.__name__, model)

if not registry:
registry = get_global_registry()

if not DJANGO_FILTER_INSTALLED and filter_fields:
raise Exception("Can only set filter_fields if Django-Filter is installed")

Expand Down Expand Up @@ -300,6 +303,7 @@ def __init_subclass_with_meta__(

_meta = DjangoObjectOptions(cls)
_meta.model = model
_meta.registry = registry
_meta.queryset = queryset
_meta.baseType = baseType
_meta.results_field_name = results_field_name
Expand Down Expand Up @@ -453,6 +457,7 @@ def __init_subclass_with_meta__(
_meta.output_type = output_type
_meta.output_list_type = output_list_type
_meta.model = model
_meta.registry = registry
_meta.queryset = queryset or model._default_manager
_meta.serializer_class = serializer_class
_meta.input_field_name = input_field_name
Expand Down
4 changes: 2 additions & 2 deletions graphene_django_extras/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from django.views.decorators.csrf import csrf_exempt
from graphene_django.views import GraphQLView
from graphql import Source, parse, execute
from graphql.execution.executor import subscribe
from graphql.utils.get_operation_ast import get_operation_ast
from graphql.subscription import subscribe
from graphql.utilities import get_operation_ast
from rest_framework.decorators import (
authentication_classes,
permission_classes,
Expand Down
Loading