mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-06-07 07:03:05 +03:00
Replace calls to methods removed in Django v4 (#1275)
* Replace calls to deprecated methods * Fix test config & Replace additional methods removed in django 4.0 * Update tox for official Django 4 release * 2.16.0 * Revert version update * Remove duplicate entry Co-authored-by: Jeremy Stretch <jstretch@ns1.com> * Limit max Django version Co-authored-by: Jeremy Stretch <jstretch@ns1.com> * Remove Python 3.5 (deprecated) from tox Co-authored-by: Jeremy Stretch <jstretch@ns1.com> Co-authored-by: Ülgen Sarıkavak <ulgens@users.noreply.github.com> Co-authored-by: Jeremy Stretch <jstretch@ns1.com>
This commit is contained in:
parent
d52b18a700
commit
a7a8b3dca6
27
.github/workflows/tests.yml
vendored
27
.github/workflows/tests.yml
vendored
|
@ -8,12 +8,29 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
max-parallel: 4
|
max-parallel: 4
|
||||||
matrix:
|
matrix:
|
||||||
django: ["1.11", "2.2", "3.0", "3.1"]
|
django: ["2.2", "3.0", "3.1", "3.2", "4.0"]
|
||||||
python-version: ["3.6", "3.7", "3.8"]
|
python-version: ["3.8", "3.9"]
|
||||||
include:
|
include:
|
||||||
- django: "1.11"
|
- django: "2.2"
|
||||||
python-version: "2.7"
|
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:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from django.db import models
|
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")))
|
CHOICES = ((1, "this"), (2, _("that")))
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ from collections import namedtuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from django.db import models
|
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
|
from py.test import raises
|
||||||
|
|
||||||
import graphene
|
import graphene
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from django.conf.urls import url
|
from django.urls import re_path
|
||||||
|
|
||||||
from ..views import GraphQLView
|
from ..views import GraphQLView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r"^graphql/batch", GraphQLView.as_view(batch=True)),
|
re_path(r"^graphql/batch", GraphQLView.as_view(batch=True)),
|
||||||
url(r"^graphql", GraphQLView.as_view(graphiql=True)),
|
re_path(r"^graphql", GraphQLView.as_view(graphiql=True)),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls import url
|
from django.urls import re_path
|
||||||
|
|
||||||
from ..views import GraphQLView
|
from ..views import GraphQLView
|
||||||
from .schema_view import schema
|
from .schema_view import schema
|
||||||
|
@ -10,4 +10,4 @@ class CustomGraphQLView(GraphQLView):
|
||||||
pretty = True
|
pretty = True
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [url(r"^graphql/inherited/$", CustomGraphQLView.as_view())]
|
urlpatterns = [re_path(r"^graphql/inherited/$", CustomGraphQLView.as_view())]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.conf.urls import url
|
from django.urls import re_path
|
||||||
|
|
||||||
from ..views import GraphQLView
|
from ..views import GraphQLView
|
||||||
from .schema_view import schema
|
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))]
|
||||||
|
|
|
@ -3,7 +3,7 @@ import inspect
|
||||||
import six
|
import six
|
||||||
from django.db import connection, models, transaction
|
from django.db import connection, models, transaction
|
||||||
from django.db.models.manager import Manager
|
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 django.utils.functional import Promise
|
||||||
|
|
||||||
from graphene.utils.str_converters import to_camel_case
|
from graphene.utils.str_converters import to_camel_case
|
||||||
|
@ -26,7 +26,7 @@ def isiterable(value):
|
||||||
|
|
||||||
def _camelize_django_str(s):
|
def _camelize_django_str(s):
|
||||||
if isinstance(s, Promise):
|
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
|
return to_camel_case(s) if isinstance(s, six.string_types) else s
|
||||||
|
|
||||||
|
|
||||||
|
|
22
tox.ini
22
tox.ini
|
@ -1,24 +1,26 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist =
|
envlist =
|
||||||
py{27,35,36,37,38}-django{111,20,21,22,master},
|
py{36,37,38,39}-django22,
|
||||||
py{36,37,38}-django{30,31},
|
py{36,37,38,39}-django{30,31},
|
||||||
|
py{36,37,38,39,310}-django32,
|
||||||
|
py{38,39,310}-django{40,master},
|
||||||
black,flake8
|
black,flake8
|
||||||
|
|
||||||
[gh-actions]
|
[gh-actions]
|
||||||
python =
|
python =
|
||||||
2.7: py27
|
|
||||||
3.6: py36
|
3.6: py36
|
||||||
3.7: py37
|
3.7: py37
|
||||||
3.8: py38
|
3.8: py38
|
||||||
|
3.9: py39
|
||||||
|
3.10: py310
|
||||||
|
|
||||||
[gh-actions:env]
|
[gh-actions:env]
|
||||||
DJANGO =
|
DJANGO =
|
||||||
1.11: django111
|
|
||||||
2.0: django20
|
|
||||||
2.1: django21
|
|
||||||
2.2: django22
|
2.2: django22
|
||||||
3.0: django30
|
3.0: django30
|
||||||
3.1: django31
|
3.1: django31
|
||||||
|
3.2: django32
|
||||||
|
4.0: django40
|
||||||
master: djangomaster
|
master: djangomaster
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
@ -29,13 +31,11 @@ setenv =
|
||||||
deps =
|
deps =
|
||||||
-e.[test]
|
-e.[test]
|
||||||
psycopg2-binary
|
psycopg2-binary
|
||||||
django111: Django>=1.11,<2.0
|
|
||||||
django111: djangorestframework<3.12
|
|
||||||
django20: Django>=2.0,<2.1
|
|
||||||
django21: Django>=2.1,<2.2
|
|
||||||
django22: Django>=2.2,<3.0
|
django22: Django>=2.2,<3.0
|
||||||
django30: Django>=3.0a1,<3.1
|
django30: Django>=3.0,<3.1
|
||||||
django31: Django>=3.1,<3.2
|
django31: Django>=3.1,<3.2
|
||||||
|
django32: Django>=3.2,<4.0
|
||||||
|
django40: Django>=4.0,<4.1
|
||||||
djangomaster: https://github.com/django/django/archive/master.zip
|
djangomaster: https://github.com/django/django/archive/master.zip
|
||||||
commands = {posargs:py.test --cov=graphene_django graphene_django examples}
|
commands = {posargs:py.test --cov=graphene_django graphene_django examples}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user