Repository: graphql-python/graphene-django

Issue:
Django v4.0 support
Hello!

Django 4.0 is due out next week and I was attempting to test the release candidate with my project. Have there been any efforts to check/fix compatibility with the new version?


Discussion:

Resolving patch:
diff --git a/graphene_django/utils/utils.py b/graphene_django/utils/utils.py
--- a/graphene_django/utils/utils.py
+++ b/graphene_django/utils/utils.py
@@ -3,7 +3,7 @@
 import six
 from django.db import connection, models, transaction
 from django.db.models.manager import Manager
-from django.utils.encoding import force_text
+from django.utils.encoding import force_str
 from django.utils.functional import Promise
 
 from graphene.utils.str_converters import to_camel_case
@@ -26,7 +26,7 @@ def isiterable(value):
 
 def _camelize_django_str(s):
     if isinstance(s, Promise):
-        s = force_text(s)
+        s = force_str(s)
     return to_camel_case(s) if isinstance(s, six.string_types) else s
 
 


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -8,12 +8,29 @@ jobs:
     strategy:
       max-parallel: 4
       matrix:
-        django: ["1.11", "2.2", "3.0", "3.1"]
-        python-version: ["3.6", "3.7", "3.8"]
+        django: ["2.2", "3.0", "3.1", "3.2", "4.0"]
+        python-version: ["3.8", "3.9"]
         include:
-          - django: "1.11"
-            python-version: "2.7"
-
+          - django: "2.2"
+            python-version: "3.6"
+          - django: "2.2"
+            python-version: "3.7"
+          - django: "3.0"
+            python-version: "3.6"
+          - django: "3.0"
+            python-version: "3.7"
+          - django: "3.1"
+            python-version: "3.6"
+          - django: "3.1"
+            python-version: "3.7"
+          - django: "3.2"
+            python-version: "3.6"
+          - django: "3.2"
+            python-version: "3.7"
+          - django: "3.2"
+            python-version: "3.10"
+          - django: "4.0"
+            python-version: "3.10"
     steps:
     - uses: actions/checkout@v1
     - name: Set up Python ${{ matrix.python-version }}
diff --git a/graphene_django/tests/models.py b/graphene_django/tests/models.py
--- a/graphene_django/tests/models.py
+++ b/graphene_django/tests/models.py
@@ -1,7 +1,7 @@
 from __future__ import absolute_import
 
 from django.db import models
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
 
 CHOICES = ((1, "this"), (2, _("that")))
 
diff --git a/graphene_django/tests/test_converter.py b/graphene_django/tests/test_converter.py
--- a/graphene_django/tests/test_converter.py
+++ b/graphene_django/tests/test_converter.py
@@ -2,7 +2,7 @@
 
 import pytest
 from django.db import models
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
 from py.test import raises
 
 import graphene
diff --git a/graphene_django/tests/urls.py b/graphene_django/tests/urls.py
--- a/graphene_django/tests/urls.py
+++ b/graphene_django/tests/urls.py
@@ -1,8 +1,8 @@
-from django.conf.urls import url
+from django.urls import re_path
 
 from ..views import GraphQLView
 
 urlpatterns = [
-    url(r"^graphql/batch", GraphQLView.as_view(batch=True)),
-    url(r"^graphql", GraphQLView.as_view(graphiql=True)),
+    re_path(r"^graphql/batch", GraphQLView.as_view(batch=True)),
+    re_path(r"^graphql", GraphQLView.as_view(graphiql=True)),
 ]
diff --git a/graphene_django/tests/urls_inherited.py b/graphene_django/tests/urls_inherited.py
--- a/graphene_django/tests/urls_inherited.py
+++ b/graphene_django/tests/urls_inherited.py
@@ -1,4 +1,4 @@
-from django.conf.urls import url
+from django.urls import re_path
 
 from ..views import GraphQLView
 from .schema_view import schema
@@ -10,4 +10,4 @@ class CustomGraphQLView(GraphQLView):
     pretty = True
 
 
-urlpatterns = [url(r"^graphql/inherited/$", CustomGraphQLView.as_view())]
+urlpatterns = [re_path(r"^graphql/inherited/$", CustomGraphQLView.as_view())]
diff --git a/graphene_django/tests/urls_pretty.py b/graphene_django/tests/urls_pretty.py
--- a/graphene_django/tests/urls_pretty.py
+++ b/graphene_django/tests/urls_pretty.py
@@ -1,6 +1,6 @@
-from django.conf.urls import url
+from django.urls import re_path
 
 from ..views import GraphQLView
 from .schema_view import schema
 
-urlpatterns = [url(r"^graphql", GraphQLView.as_view(schema=schema, pretty=True))]
+urlpatterns = [re_path(r"^graphql", GraphQLView.as_view(schema=schema, pretty=True))]