mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-14 02:02:20 +03:00
Fix: BaseDjangoFormMutation should use from_global_id when fetching existing instance #460
This commit is contained in:
parent
f76f38ef30
commit
fbc4e62c63
|
@ -13,6 +13,8 @@ from graphene.types.mutation import MutationOptions
|
||||||
from graphene.types.utils import yank_fields_from_attrs
|
from graphene.types.utils import yank_fields_from_attrs
|
||||||
from graphene_django.registry import get_global_registry
|
from graphene_django.registry import get_global_registry
|
||||||
|
|
||||||
|
from graphql_relay import from_global_id
|
||||||
|
|
||||||
from .converter import convert_form_field
|
from .converter import convert_form_field
|
||||||
from .types import ErrorType
|
from .types import ErrorType
|
||||||
|
|
||||||
|
@ -63,7 +65,8 @@ class BaseDjangoFormMutation(ClientIDMutation):
|
||||||
|
|
||||||
pk = input.pop("id", None)
|
pk = input.pop("id", None)
|
||||||
if pk:
|
if pk:
|
||||||
instance = cls._meta.model._default_manager.get(pk=pk)
|
_pk = from_global_id(pk)[1]
|
||||||
|
instance = cls._meta.model._default_manager.get(pk=_pk)
|
||||||
kwargs["instance"] = instance
|
kwargs["instance"] = instance
|
||||||
|
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
Loading…
Reference in New Issue
Block a user