From 8054803fde619c820a16cd855c8471d2ee62f1a1 Mon Sep 17 00:00:00 2001 From: "radoslaw.kowalski" Date: Thu, 11 Jun 2020 11:04:19 +0200 Subject: [PATCH] Bump PendingDeprecationWarning to DeprecationWarning * as it is a major release 3, start right away from DeprecationWarning for ObjectTypes missing fields or exclude option * updated docs information to be more forbidding --- docs/queries.rst | 5 ++--- graphene_django/tests/test_types.py | 2 +- graphene_django/types.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/queries.rst b/docs/queries.rst index 9969373..0ec8b65 100644 --- a/docs/queries.rst +++ b/docs/queries.rst @@ -54,9 +54,8 @@ all fields that should be exposed using the fields attribute. This will make it less likely to result in unintentionally exposing data when your models change. -Setting neither ``fields`` nor ``exclude`` is allowed but will raise a warning, to -avoid that you can easily make ``DjangoObjectType`` include all fields in the model as -described below. +Setting neither ``fields`` nor ``exclude`` is deprecated and will raise a warning, you should at least explicitly make +``DjangoObjectType`` include all fields in the model as described below. ``fields`` ~~~~~~~~~~ diff --git a/graphene_django/tests/test_types.py b/graphene_django/tests/test_types.py index 8f8126f..a62c4c9 100644 --- a/graphene_django/tests/test_types.py +++ b/graphene_django/tests/test_types.py @@ -482,7 +482,7 @@ def test_django_objecttype_exclude_fields_exist_on_model(): @with_local_registry def test_django_objecttype_neither_fields_nor_exclude(): with pytest.warns( - PendingDeprecationWarning, + DeprecationWarning, match=r"Creating a DjangoObjectType without either the `fields` " "or the `exclude` option is deprecated.", ): diff --git a/graphene_django/types.py b/graphene_django/types.py index dcfbbdb..7d14443 100644 --- a/graphene_django/types.py +++ b/graphene_django/types.py @@ -226,7 +226,7 @@ class DjangoObjectType(ObjectType): "or the `exclude` option is deprecated. Add an explicit `fields " "= '__all__'` option on DjangoObjectType {class_name} to use all " "fields".format(class_name=cls.__name__,), - PendingDeprecationWarning, + DeprecationWarning, stacklevel=2, )