mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-03 20:03:30 +03:00
Change mutation
This commit is contained in:
parent
2743aae492
commit
2887830cf0
|
@ -10,7 +10,6 @@ from graphene.types.mutation import MutationOptions
|
||||||
# InputObjectType,
|
# InputObjectType,
|
||||||
# )
|
# )
|
||||||
from graphene.types.utils import yank_fields_from_attrs
|
from graphene.types.utils import yank_fields_from_attrs
|
||||||
from graphene.utils.str_converters import to_camel_case
|
|
||||||
from graphene_django.registry import get_global_registry
|
from graphene_django.registry import get_global_registry
|
||||||
|
|
||||||
from ..types import ErrorType
|
from ..types import ErrorType
|
||||||
|
@ -45,13 +44,7 @@ class BaseDjangoFormMutation(ClientIDMutation):
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
return cls.perform_mutate(form, info)
|
return cls.perform_mutate(form, info)
|
||||||
else:
|
else:
|
||||||
errors = [
|
errors = ErrorType.from_errors(form.errors)
|
||||||
ErrorType(
|
|
||||||
field=to_camel_case(key) if key != "__all__" else key,
|
|
||||||
messages=value,
|
|
||||||
)
|
|
||||||
for key, value in form.errors.items()
|
|
||||||
]
|
|
||||||
|
|
||||||
return cls(errors=errors)
|
return cls(errors=errors)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user