From 07afaecc8efc32619e1827a14712067fda731d2c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 18:54:42 +0000 Subject: [PATCH 1/2] chore(deps-dev): Bump django from 3.2.19 to 3.2.20 Bumps [django](https://github.com/django/django) from 3.2.19 to 3.2.20. - [Commits](https://github.com/django/django/compare/3.2.19...3.2.20) --- updated-dependencies: - dependency-name: django dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 8885def..dec2703 100644 --- a/poetry.lock +++ b/poetry.lock @@ -130,13 +130,13 @@ toml = ["tomli"] [[package]] name = "django" -version = "3.2.19" +version = "3.2.20" description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." optional = false python-versions = ">=3.6" files = [ - {file = "Django-3.2.19-py3-none-any.whl", hash = "sha256:21cc991466245d659ab79cb01204f9515690f8dae00e5eabde307f14d24d4d7d"}, - {file = "Django-3.2.19.tar.gz", hash = "sha256:031365bae96814da19c10706218c44dff3b654cc4de20a98bd2d29b9bde469f0"}, + {file = "Django-3.2.20-py3-none-any.whl", hash = "sha256:a477ab326ae7d8807dc25c186b951ab8c7648a3a23f9497763c37307a2b5ef87"}, + {file = "Django-3.2.20.tar.gz", hash = "sha256:dec2a116787b8e14962014bf78e120bba454135108e1af9e9b91ade7b2964c40"}, ] [package.dependencies] From 7e0bcbf4fe417543916f6d5ba31b454404976b46 Mon Sep 17 00:00:00 2001 From: Ashish Date: Thu, 28 Sep 2023 21:11:27 +1000 Subject: [PATCH 2/2] Added uuid support. --- graphene_django_cud/mutations/core.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/graphene_django_cud/mutations/core.py b/graphene_django_cud/mutations/core.py index c27444f..22f113f 100644 --- a/graphene_django_cud/mutations/core.py +++ b/graphene_django_cud/mutations/core.py @@ -1,4 +1,5 @@ import enum +import uuid from typing import Iterable, Union from django.db import models @@ -328,8 +329,8 @@ def create_obj( new_value = cls.resolve_id(value) # The order here is important elif isinstance(field, models.OneToOneField): - # If the value is an integer or a string, we assume it is an ID - if isinstance(value, str) or isinstance(value, int): + # If the value is an integer or a string or a uuid, we assume it is an ID + if isinstance(value, str) or isinstance(value, int) or isinstance(value, uuid.UUID): name = getattr(field, "db_column", None) or name + "_id" new_value = cls.resolve_id(value) else: @@ -395,8 +396,8 @@ def create_obj( # Value was not transformed if new_value == value: - # If the value is an integer or a string, we assume it is an ID - if isinstance(value, str) or isinstance(value, int): + # If the value is an integer or a string or a uuid, we assume it is an ID + if isinstance(value, str) or isinstance(value, int) or isinstance(value, uuid.UUID): name = getattr(field, "db_column", None) or name + "_id" new_value = cls.resolve_id(value) else: @@ -576,8 +577,8 @@ def update_obj( if isinstance(field, models.AutoField): new_value = cls.resolve_id(value) elif isinstance(field, models.OneToOneField): - # If the value is an integer or a string, we assume it is an ID - if isinstance(value, str) or isinstance(value, int): + # If the value is an integer or a string or a uuid, we assume it is an ID + if isinstance(value, str) or isinstance(value, int) or isinstance(value, uuid.UUID): name = getattr(field, "db_column", None) or name + "_id" new_value = cls.resolve_id(value) else: @@ -586,8 +587,8 @@ def update_obj( value[field.remote_field.name] = obj.pk new_value = cls.create_or_update_one_to_one_relation(obj, field, value, extra_data, info) elif isinstance(field, models.OneToOneRel): - # If the value is an integer or a string, we assume it is an ID - if isinstance(value, str) or isinstance(value, int): + # If the value is an integer or a string or a uuid, we assume it is an ID + if isinstance(value, str) or isinstance(value, int) or isinstance(value, uuid.UUID): name = getattr(field, "db_column", None) or name + "_id" new_value = cls.resolve_id(value) else: