Closed ldynia closed 9 months ago
This is indeed not possible currently.
What can be done is to add a flag to the mutation like key_attr
(or a better name) to be used to retrieve the object instead of pk
.
Do you want to try to open a PR for that? I'll gladly review it and you can also ping me on discord if you need any help while writing it
Hi @bellini666 I'd love to do PR, but I have no time for it :(. If someone is interested in implementing this, then I drop this answer on stackoverflow.com. It's a good place to pick it up.
@bellini666, @ldynia, so just for fun I have made the PR which adds this feature.
:heart: it! I'll test it once it's merged. But at the moment PR is stopped by this error: https://github.com/strawberry-graphql/strawberry-graphql-django/pull/387
@thepapermen just reviewed your PR :)
There are a couple of minor comments there that after fixed should be good to be merged
❤️ it! I'll test it once it's merged. But at the moment PR is stopped by this error: #387
@ldynia, now it's merged. :smile:
I'll assume this issue has been fixed by https://github.com/strawberry-graphql/strawberry-graphql-django/pull/387 , so I'm closing the issue.
If not, please let me know :)
The default CUD operation in srawberry_django identifies the model to be mutated by the model's id (the database's id column, which is the Primary Key). How can I change this behavior to point to a column's/model's UUID without overriding strawberry_django.mutations.update method?
In simple terms, how to do a search on a field that is not id/PK in strawberry-graphql-djang without mending update method?
Upvote & Fund