mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 01:32:24 +03:00
added support for partial updates in serializers
This commit is contained in:
parent
45df7445f4
commit
b939ce6d2b
|
@ -102,8 +102,10 @@ class SerializerMutation(ClientIDMutation):
|
|||
instance = get_object_or_404(
|
||||
model_class, **{lookup_field: input[lookup_field]}
|
||||
)
|
||||
partial = True
|
||||
elif "create" in cls._meta.model_operations:
|
||||
instance = None
|
||||
partial = False
|
||||
else:
|
||||
raise Exception(
|
||||
'Invalid update operation. Input parameter "{}" required.'.format(
|
||||
|
@ -115,6 +117,7 @@ class SerializerMutation(ClientIDMutation):
|
|||
"instance": instance,
|
||||
"data": input,
|
||||
"context": {"request": info.context},
|
||||
"partial": partial,
|
||||
}
|
||||
|
||||
return {"data": input, "context": {"request": info.context}}
|
||||
|
|
Loading…
Reference in New Issue
Block a user