From c2818c85e005502a35e0ee16ec976ec33f29aa5d Mon Sep 17 00:00:00 2001 From: tschilling Date: Sun, 12 Dec 2021 11:18:37 -0600 Subject: [PATCH] Switch from re_path to path. The DEFAULT_GRAPHQL_URL had to change because it doesn't take into account the APPEND_SLASH setting from within Django. --- README.md | 2 +- docs/authorization.rst | 2 +- graphene_django/tests/urls.py | 6 +++--- graphene_django/tests/urls_inherited.py | 4 ++-- graphene_django/tests/urls_pretty.py | 4 ++-- graphene_django/utils/testing.py | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5045e78..6f06ccc 100644 --- a/README.md +++ b/README.md @@ -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)), ] ``` diff --git a/docs/authorization.rst b/docs/authorization.rst index 39305f6..bc88cda 100644 --- a/docs/authorization.rst +++ b/docs/authorization.rst @@ -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 diff --git a/graphene_django/tests/urls.py b/graphene_django/tests/urls.py index f2faae2..3702ce5 100644 --- a/graphene_django/tests/urls.py +++ b/graphene_django/tests/urls.py @@ -1,8 +1,8 @@ -from django.urls import re_path +from django.urls import path from ..views import GraphQLView urlpatterns = [ - re_path(r"^graphql/batch", GraphQLView.as_view(batch=True)), - re_path(r"^graphql", GraphQLView.as_view(graphiql=True)), + path("graphql/batch", GraphQLView.as_view(batch=True)), + path("graphql", GraphQLView.as_view(graphiql=True)), ] diff --git a/graphene_django/tests/urls_inherited.py b/graphene_django/tests/urls_inherited.py index 815d04d..1e65da0 100644 --- a/graphene_django/tests/urls_inherited.py +++ b/graphene_django/tests/urls_inherited.py @@ -1,4 +1,4 @@ -from django.urls import re_path +from django.urls import path from ..views import GraphQLView from .schema_view import schema @@ -10,4 +10,4 @@ class CustomGraphQLView(GraphQLView): pretty = True -urlpatterns = [re_path(r"^graphql/inherited/$", CustomGraphQLView.as_view())] +urlpatterns = [path("graphql/inherited/", CustomGraphQLView.as_view())] diff --git a/graphene_django/tests/urls_pretty.py b/graphene_django/tests/urls_pretty.py index 635d4f3..6275934 100644 --- a/graphene_django/tests/urls_pretty.py +++ b/graphene_django/tests/urls_pretty.py @@ -1,6 +1,6 @@ -from django.urls import re_path +from django.urls import path from ..views import GraphQLView from .schema_view import schema -urlpatterns = [re_path(r"^graphql", GraphQLView.as_view(schema=schema, pretty=True))] +urlpatterns = [path("graphql", GraphQLView.as_view(schema=schema, pretty=True))] diff --git a/graphene_django/utils/testing.py b/graphene_django/utils/testing.py index 763196d..b91a02f 100644 --- a/graphene_django/utils/testing.py +++ b/graphene_django/utils/testing.py @@ -3,7 +3,7 @@ import warnings from django.test import Client, TestCase, TransactionTestCase -DEFAULT_GRAPHQL_URL = "/graphql/" +DEFAULT_GRAPHQL_URL = "/graphql" def graphql_query(