Graphene мутация update не обновляет, а создает новый объект бд

Созданный запрос на обновление данных по типу put не обновляет объект, а создает новый. не могу понять почему, помогите разобраться.

    from django.db import models

class  EducationalInstitution(models.Model):
    # выбор в полях по типу учебного заведения\формы владения
    EDUCTIONAL_INSTITUTUTION_TYPE_CHOICES = (
        ('SCHOOL', 'Школа'),
        ('UNIVERSITY', 'Университет'),
      )

    EDUCTIONAL_INSTITUTTION_MANAGEMENT_TYPE_CHOICES = (
        ('PUBLIC', 'Государственная'),
        ('PRIVATE', 'Частная'),
    )

    full_name = models.CharField(verbose_name = 'Полное название учебного заведения',
         max_length=100,)
    введите сюда код

    educational_institution_type = models.CharField( # new
        choices=EDUCTIONAL_INSTITUTUTION_TYPE_CHOICES,
        max_length=11,
        verbose_name='Тип учебного заведения',
    )

    educational_institution_management_type = models.CharField( # new
        choices=EDUCTIONAL_INSTITUTTION_MANAGEMENT_TYPE_CHOICES,
        max_length=7,
        verbose_name='Тип формы владения учебного заведения',
    )
    class Meta:
        verbose_name = 'Учебное заведение'
        verbose_name_plural = 'Учебные заведения'

    def __str__(self):
        return self.full_name



    import graphene
from graphene_django.types import DjangoObjectType, ObjectType
from .models import EducationalInstitution


class InstitutionType(DjangoObjectType):
    class Meta:
        model = EducationalInstitution

class Query(ObjectType):
    institutions = graphene.List(InstitutionType)

    institution = graphene.Field(
        InstitutionType,
        id=graphene.Int(),
        full_name=graphene.String(),
        educational_institution_type=graphene.String(),
        educational_institution_management_type=graphene.String()
        )
    ok = True

    def resolve_institutions(self, info, **kwargs):
    # Querying a list
        return EducationalInstitution.objects.all()

    def resolve_institution(self, info, **kwargs):
    # Querying a single question
        id = kwargs.get('id')
        fullName = kwargs.get('full_name')
        institutionsType = kwargs.get('educational_institution_type')
        institutionManagementType = kwargs.get('educational_institution_management_type')
        if id is not None:
            return EducationalInstitution.objects.get(pk=id)
        if fullName is not None:
            return EducationalInstitution.objects.get(fullName=fullName)
        if institutionsType is not None:
            return EducationalInstitution.objects.get(institutionsType=institutionsType)
        if institutionsManagementType is not None:
            return EducationalInstitution.objects.get(institutionsManagementType=institutionManagementType)

        return None

class InstitutionInput(graphene.InputObjectType):
    id = graphene.ID()
    full_name = graphene.String()
    educational_institution_type = graphene.String()
    educational_institution_management_type = graphene.String()

class CreateInstitution(graphene.Mutation):
    class Arguments:
        input = InstitutionInput(required=True)

    ok = graphene.Boolean()
    institution = graphene.Field(InstitutionType)

    @staticmethod
    def mutate(root, info, input=None):
        ok= True
        institution_instance = EducationalInstitution(
            full_name=input.full_name,
            educational_institution_type=input.educational_institution_type,
            educational_institution_management_type=input.educational_institution_management_type
            )
        institution_instance.save()
        return CreateInstitution(ok=ok, institution=institution_instance)

class UpdateInstitution(graphene.Mutation):
    class Arguments:
        id = graphene.Int(required=True)
        input = InstitutionInput(required=True)

    ok = graphene.Boolean()
    institution = graphene.Field(InstitutionType)

    @staticmethod
    def mutate(root, info, id, input=None):
        ok = False
        institution_instance = EducationalInstitution.objects.get(pk=id)
        if institution_instance:
            ok = True
            institution_instance = EducationalInstitution(
                full_name = input.full_name,
                educational_institution_type = input.educational_institution_type,
                educational_institution_management_type = input.educational_institution_management_type
            )
            institution_instance.save()
            return UpdateInstitution(ok=ok, institution=institution_instance)
        return UpdateInstitution(ok=ok, institution=None)





class Mutation(graphene.ObjectType):
    create_institution = CreateInstitution.Field()
    update_institution = UpdateInstitution.Field()

schema = graphene.Schema(query=Query, mutation=Mutation)

Ответы (0 шт):