From 9327ef4d32dae36a952b207a0d36bc6a6618d522 Mon Sep 17 00:00:00 2001 From: Daniele Bernardini Date: Wed, 29 Aug 2018 12:31:26 +0200 Subject: [PATCH] Update middleware.rst I think a description of where the Middleware needs to go to be executed every time would be useful. It would have saved me some time. --- docs/execution/middleware.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/execution/middleware.rst b/docs/execution/middleware.rst index 55efe7305..c2971082a 100644 --- a/docs/execution/middleware.rst +++ b/docs/execution/middleware.rst @@ -41,6 +41,18 @@ And then execute it with: result = schema.execute('THE QUERY', middleware=[AuthorizationMiddleware()]) +Or set it up in the default middleware to be executed for every query in settings.py: + +.. code:: python + + GRAPHENE = { + 'SCHEMA': 'my_app.schema.schema' + 'MIDDLEWARE': ( + 'graphene_django.debug.DjangoDebugMiddleware', + 'mymodule.AuthorizationMiddleware' + ) + } + Functional example ------------------ @@ -69,3 +81,4 @@ And then execute it with: .. code:: python result = schema.execute('THE QUERY', middleware=[timing_middleware]) +