mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-04 20:33:12 +03:00
Fixing mutation
This commit is contained in:
parent
5427e2c939
commit
2743aae492
|
@ -53,7 +53,7 @@ class BaseDjangoFormMutation(ClientIDMutation):
|
||||||
for key, value in form.errors.items()
|
for key, value in form.errors.items()
|
||||||
]
|
]
|
||||||
|
|
||||||
return cls(errors=errors, **form.data)
|
return cls(errors=errors)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_form(cls, root, info, **input):
|
def get_form(cls, root, info, **input):
|
||||||
|
@ -176,17 +176,6 @@ class DjangoModelFormMutation(BaseDjangoFormMutation):
|
||||||
_meta=_meta, input_fields=input_fields, **options
|
_meta=_meta, input_fields=input_fields, **options
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def mutate_and_get_payload(cls, root, info, **input):
|
|
||||||
form = cls.get_form(root, info, **input)
|
|
||||||
|
|
||||||
if form.is_valid():
|
|
||||||
return cls.perform_mutate(form, info)
|
|
||||||
else:
|
|
||||||
errors = ErrorType.from_errors(form.errors)
|
|
||||||
|
|
||||||
return cls(errors=errors)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def perform_mutate(cls, form, info):
|
def perform_mutate(cls, form, info):
|
||||||
obj = form.save()
|
obj = form.save()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user