mirror of
				https://github.com/graphql-python/graphene-django.git
				synced 2025-11-04 09:57:53 +03:00 
			
		
		
		
	Django v4, python 3.10 support for graphene-django v3 (#1281)
Co-authored-by: Yair Silbermintz <MisterGlass@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									32667b5407
								
							
						
					
					
						commit
						5d5d7f1815
					
				
							
								
								
									
										8
									
								
								.github/workflows/tests.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/tests.yml
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -10,7 +10,13 @@ jobs:
 | 
			
		|||
      matrix:
 | 
			
		||||
        django: ["2.2", "3.0", "3.1", "3.2"]
 | 
			
		||||
        python-version: ["3.6", "3.7", "3.8", "3.9"]
 | 
			
		||||
 | 
			
		||||
        include:
 | 
			
		||||
          - django: "3.2"
 | 
			
		||||
            python-version: "3.10"
 | 
			
		||||
          - django: "4.0"
 | 
			
		||||
            python-version: "3.10"
 | 
			
		||||
          - django: "main"
 | 
			
		||||
            python-version: "3.10"
 | 
			
		||||
    steps:
 | 
			
		||||
    - uses: actions/checkout@v2
 | 
			
		||||
    - name: Set up Python ${{ matrix.python-version }}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ from graphene_django.views import GraphQLView
 | 
			
		|||
 | 
			
		||||
urlpatterns = [
 | 
			
		||||
    # ...
 | 
			
		||||
    path('graphql', GraphQLView.as_view(graphiql=True)),
 | 
			
		||||
    path('graphql/', GraphQLView.as_view(graphiql=True)),
 | 
			
		||||
]
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -198,7 +198,7 @@ For Django 2.2 and above:
 | 
			
		|||
 | 
			
		||||
    urlpatterns = [
 | 
			
		||||
      # some other urls
 | 
			
		||||
      path('graphql', PrivateGraphQLView.as_view(graphiql=True, schema=schema)),
 | 
			
		||||
      path('graphql/', PrivateGraphQLView.as_view(graphiql=True, schema=schema)),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
.. _LoginRequiredMixin: https://docs.djangoproject.com/en/dev/topics/auth/default/#the-loginrequired-mixin
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ def wrap_exception(exception):
 | 
			
		|||
        exc_type=force_str(type(exception)),
 | 
			
		||||
        stack="".join(
 | 
			
		||||
            traceback.format_exception(
 | 
			
		||||
                etype=type(exception), value=exception, tb=exception.__traceback__
 | 
			
		||||
                exception, value=exception, tb=exception.__traceback__
 | 
			
		||||
            )
 | 
			
		||||
        ),
 | 
			
		||||
    )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,7 +48,7 @@ class CommandArguments(BaseCommand):
 | 
			
		|||
class Command(CommandArguments):
 | 
			
		||||
    help = "Dump Graphene schema as a JSON or GraphQL file"
 | 
			
		||||
    can_import_settings = True
 | 
			
		||||
    requires_system_checks = False
 | 
			
		||||
    requires_system_checks = []
 | 
			
		||||
 | 
			
		||||
    def save_json_file(self, out, schema_dict, indent):
 | 
			
		||||
        with open(out, "w") as outfile:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,8 @@
 | 
			
		|||
from django.conf.urls import url
 | 
			
		||||
from django.urls import path
 | 
			
		||||
 | 
			
		||||
from ..views import GraphQLView
 | 
			
		||||
 | 
			
		||||
urlpatterns = [
 | 
			
		||||
    url(r"^graphql/batch", GraphQLView.as_view(batch=True)),
 | 
			
		||||
    url(r"^graphql", GraphQLView.as_view(graphiql=True)),
 | 
			
		||||
    path("graphql/batch", GraphQLView.as_view(batch=True)),
 | 
			
		||||
    path("graphql", GraphQLView.as_view(graphiql=True)),
 | 
			
		||||
]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
from django.conf.urls import url
 | 
			
		||||
from django.urls import 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 = [path("graphql/inherited/", CustomGraphQLView.as_view())]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
from django.conf.urls import url
 | 
			
		||||
from django.urls import path
 | 
			
		||||
 | 
			
		||||
from ..views import GraphQLView
 | 
			
		||||
from .schema_view import schema
 | 
			
		||||
 | 
			
		||||
urlpatterns = [url(r"^graphql", GraphQLView.as_view(schema=schema, pretty=True))]
 | 
			
		||||
urlpatterns = [path("graphql", GraphQLView.as_view(schema=schema, pretty=True))]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@ import warnings
 | 
			
		|||
 | 
			
		||||
from django.test import Client, TestCase, TransactionTestCase
 | 
			
		||||
 | 
			
		||||
DEFAULT_GRAPHQL_URL = "/graphql/"
 | 
			
		||||
DEFAULT_GRAPHQL_URL = "/graphql"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def graphql_query(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										13
									
								
								tox.ini
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								tox.ini
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -1,6 +1,8 @@
 | 
			
		|||
[tox]
 | 
			
		||||
envlist =
 | 
			
		||||
    py{36,37,38,39}-django{22,30,31,32,main},
 | 
			
		||||
    py{36,37,38,39}-django{22,30,31},
 | 
			
		||||
    py{36,37,38,39,310}-django32,
 | 
			
		||||
    py{38,39,310}-django{40,main},
 | 
			
		||||
    black,flake8
 | 
			
		||||
 | 
			
		||||
[gh-actions]
 | 
			
		||||
| 
						 | 
				
			
			@ -9,6 +11,7 @@ python =
 | 
			
		|||
    3.7: py37
 | 
			
		||||
    3.8: py38
 | 
			
		||||
    3.9: py39
 | 
			
		||||
    3.10: py310
 | 
			
		||||
 | 
			
		||||
[gh-actions:env]
 | 
			
		||||
DJANGO =
 | 
			
		||||
| 
						 | 
				
			
			@ -16,6 +19,7 @@ DJANGO =
 | 
			
		|||
    3.0: django30
 | 
			
		||||
    3.1: django31
 | 
			
		||||
    3.2: django32
 | 
			
		||||
    4.0: django40
 | 
			
		||||
    main: djangomain
 | 
			
		||||
 | 
			
		||||
[testenv]
 | 
			
		||||
| 
						 | 
				
			
			@ -26,12 +30,11 @@ setenv =
 | 
			
		|||
deps =
 | 
			
		||||
    -e.[test]
 | 
			
		||||
    psycopg2-binary
 | 
			
		||||
    django20: Django>=2.0,<2.1
 | 
			
		||||
    django21: Django>=2.1,<2.2
 | 
			
		||||
    django22: Django>=2.2,<3.0
 | 
			
		||||
    django30: Django>=3.0a1,<3.1
 | 
			
		||||
    django30: Django>=3.0,<3.1
 | 
			
		||||
    django31: Django>=3.1,<3.2
 | 
			
		||||
    django32: Django>=3.2a1,<3.3
 | 
			
		||||
    django32: Django>=3.2,<4.0
 | 
			
		||||
    django40: Django>=4.0,<4.1
 | 
			
		||||
    djangomain: https://github.com/django/django/archive/main.zip
 | 
			
		||||
commands = {posargs:py.test --cov=graphene_django graphene_django examples}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user