@@ -28,6 +28,7 @@ Full example
2828 class QuestionType (DjangoObjectType ):
2929 class Meta :
3030 model = Question
31+ fields = ' __all__'
3132
3233
3334 class Query :
@@ -53,6 +54,9 @@ all fields that should be exposed using the fields attribute.
5354This will make it less likely to result in unintentionally exposing data when
5455your models change.
5556
57+ Setting neither ``fields `` nor ``exclude `` is deprecated and will raise a warning, you should at least explicitly make
58+ ``DjangoObjectType `` include all fields in the model as described below.
59+
5660``fields ``
5761~~~~~~~~~~
5862
@@ -127,6 +131,7 @@ For example the following ``Model`` and ``DjangoObjectType``:
127131 class Pet (DjangoObjectType ):
128132 class Meta :
129133 model = PetModel
134+ fields = ' __all__'
130135
131136 Results in the following GraphQL schema definition:
132137
@@ -151,6 +156,7 @@ You can disable this automatic conversion by setting
151156 class Pet (DjangoObjectType ):
152157 class Meta :
153158 model = PetModel
159+ fields = ' __all__'
154160 convert_choices_to_enum = False
155161
156162 .. code ::
@@ -168,6 +174,7 @@ automatically converted into enums:
168174 class Pet (DjangoObjectType ):
169175 class Meta :
170176 model = PetModel
177+ fields = ' __all__'
171178 convert_choices_to_enum = [' kind' ]
172179
173180 **Note: ** Setting ``convert_choices_to_enum = [] `` is the same as setting it to
@@ -206,6 +213,7 @@ need to create the most basic class for this to work:
206213 class CategoryType (DjangoObjectType ):
207214 class Meta :
208215 model = Category
216+ fields = ' __all__'
209217
210218 .. _django-objecttype-get-queryset :
211219
@@ -224,6 +232,7 @@ Use this to control filtering on the ObjectType level instead of the Query objec
224232 class QuestionType (DjangoObjectType ):
225233 class Meta :
226234 model = Question
235+ fields = ' __all__'
227236
228237 @ classmethod
229238 def get_queryset (cls , queryset , info ):
@@ -347,6 +356,7 @@ the core graphene pages for more information on customizing the Relay experience
347356 class QuestionType (DjangoObjectType ):
348357 class Meta :
349358 model = Question
359+ fields = ' __all__'
350360 interfaces = (relay.Node,)
351361
352362
0 commit comments