Skip to content

Commit ffd4e40

Browse files
committed
added support for partial updates in serializers
1 parent 59f4f13 commit ffd4e40

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

graphene_django/rest_framework/mutation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ def get_serializer_kwargs(cls, root, info, **input):
102102
instance = get_object_or_404(
103103
model_class, **{lookup_field: input[lookup_field]}
104104
)
105+
partial = True
105106
elif "create" in cls._meta.model_operations:
106107
instance = None
108+
partial = False
107109
else:
108110
raise Exception(
109111
'Invalid update operation. Input parameter "{}" required.'.format(
@@ -115,6 +117,7 @@ def get_serializer_kwargs(cls, root, info, **input):
115117
"instance": instance,
116118
"data": input,
117119
"context": {"request": info.context},
120+
"partial": partial,
118121
}
119122

120123
return {"data": input, "context": {"request": info.context}}

0 commit comments

Comments
 (0)