@@ -28,6 +28,7 @@ Full example
28
28
class QuestionType (DjangoObjectType ):
29
29
class Meta :
30
30
model = Question
31
+ fields = ' __all__'
31
32
32
33
33
34
class Query :
@@ -53,6 +54,9 @@ all fields that should be exposed using the fields attribute.
53
54
This will make it less likely to result in unintentionally exposing data when
54
55
your models change.
55
56
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
+
56
60
``fields ``
57
61
~~~~~~~~~~
58
62
@@ -127,6 +131,7 @@ For example the following ``Model`` and ``DjangoObjectType``:
127
131
class Pet (DjangoObjectType ):
128
132
class Meta :
129
133
model = PetModel
134
+ fields = ' __all__'
130
135
131
136
Results in the following GraphQL schema definition:
132
137
@@ -151,6 +156,7 @@ You can disable this automatic conversion by setting
151
156
class Pet (DjangoObjectType ):
152
157
class Meta :
153
158
model = PetModel
159
+ fields = ' __all__'
154
160
convert_choices_to_enum = False
155
161
156
162
.. code ::
@@ -168,6 +174,7 @@ automatically converted into enums:
168
174
class Pet (DjangoObjectType ):
169
175
class Meta :
170
176
model = PetModel
177
+ fields = ' __all__'
171
178
convert_choices_to_enum = [' kind' ]
172
179
173
180
**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:
206
213
class CategoryType (DjangoObjectType ):
207
214
class Meta :
208
215
model = Category
216
+ fields = ' __all__'
209
217
210
218
.. _django-objecttype-get-queryset :
211
219
@@ -224,6 +232,7 @@ Use this to control filtering on the ObjectType level instead of the Query objec
224
232
class QuestionType (DjangoObjectType ):
225
233
class Meta :
226
234
model = Question
235
+ fields = ' __all__'
227
236
228
237
@ classmethod
229
238
def get_queryset (cls , queryset , info ):
@@ -347,6 +356,7 @@ the core graphene pages for more information on customizing the Relay experience
347
356
class QuestionType (DjangoObjectType ):
348
357
class Meta :
349
358
model = Question
359
+ fields = ' __all__'
350
360
interfaces = (relay.Node,)
351
361
352
362
0 commit comments