Skip to content

Mutation update how pass null value #1184

Answered by spockNinja
juliocebrito asked this question in Q&A
Discussion options

You must be logged in to vote

@juliocebrito

I haven't tried this myself recently on the latest graphene/graphene-django versions. But based on these docs for graphene, I believe you should be able to do the following:

class UpdateModel(graphene.Mutation):
    class Arguments:
        id = graphene.ID()
        date = graphene.Date(required=False)

    @staticmethod
    def mutate(root, info, id, date=None):
        # handle empty date

Let me know if that answers your question and works for you.

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by zbyte64
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #344 on April 14, 2021 20:21.