File tree 2 files changed +18
-0
lines changed
graphene_django/rest_framework 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ def fields_for_serializer(
39
39
field .read_only
40
40
and is_input
41
41
and lookup_field != name , # don't show read_only fields in Input
42
+ isinstance (
43
+ field , serializers .HiddenField
44
+ ), # don't show hidden fields in Input
42
45
]
43
46
)
44
47
Original file line number Diff line number Diff line change @@ -164,6 +164,21 @@ class Meta:
164
164
), "'cool_name' is read_only field and shouldn't be on arguments"
165
165
166
166
167
+ def test_hidden_fields ():
168
+ class SerializerWithHiddenField (serializers .Serializer ):
169
+ cool_name = serializers .CharField ()
170
+ user = serializers .HiddenField (default = serializers .CurrentUserDefault ())
171
+
172
+ class MyMutation (SerializerMutation ):
173
+ class Meta :
174
+ serializer_class = SerializerWithHiddenField
175
+
176
+ assert "cool_name" in MyMutation .Input ._meta .fields
177
+ assert (
178
+ "user" not in MyMutation .Input ._meta .fields
179
+ ), "'user' is hidden field and shouldn't be on arguments"
180
+
181
+
167
182
def test_nested_model ():
168
183
class MyFakeModelGrapheneType (DjangoObjectType ):
169
184
class Meta :
You can’t perform that action at this time.
0 commit comments