Skip to content

Commit

Permalink
Added documentation on how to accept files in a mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
BossGrand committed Feb 6, 2017
1 parent a3c3be2 commit 1232ff3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/relay/mutations.rst
Expand Up @@ -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)

0 comments on commit 1232ff3

Please sign in to comment.