From 1232ff3ee1e4006a262be5e50664f44c6e635200 Mon Sep 17 00:00:00 2001 From: BossGrand Date: Mon, 6 Feb 2017 11:40:04 -0800 Subject: [PATCH] Added documentation on how to accept files in a mutation --- docs/relay/mutations.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/relay/mutations.rst b/docs/relay/mutations.rst index c10b2e29..16dc9084 100644 --- a/docs/relay/mutations.rst +++ b/docs/relay/mutations.rst @@ -27,3 +27,29 @@ subclass of ``relay.ClientIDMutation``. ship = create_ship(ship_name, faction_id) faction = get_faction(faction_id) return IntroduceShip(ship=ship, faction=faction) + + + +Accepting Files +------------- + +Mutations can also accept files, they will be in the context varibale + +.. code:: python + + class UploadFile(graphene.ClientIDMutation): + class Input: + pass + # nothing needed for uploading file + + # your return fields + success = graphene.String() + + @classmethod + def mutate_and_get_payload(cls, input, context, info): + files = context.FILES + print(files) + + # do something with files + + return UploadFile(success=True) \ No newline at end of file