mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-26 03:24:07 +03:00
Ensure CSRF cookie is set. Updated dev version
This commit is contained in:
parent
d05407f6a5
commit
317c8ceec4
|
@ -6,7 +6,9 @@ import six
|
||||||
from django.http import HttpResponse, HttpResponseNotAllowed
|
from django.http import HttpResponse, HttpResponseNotAllowed
|
||||||
from django.http.response import HttpResponseBadRequest
|
from django.http.response import HttpResponseBadRequest
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from django.utils.decorators import method_decorator
|
||||||
from django.views.generic import View
|
from django.views.generic import View
|
||||||
|
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||||
|
|
||||||
from graphql import Source, execute, parse, validate
|
from graphql import Source, execute, parse, validate
|
||||||
from graphql.error import format_error as format_graphql_error
|
from graphql.error import format_error as format_graphql_error
|
||||||
|
@ -89,6 +91,7 @@ class GraphQLView(View):
|
||||||
def get_context(self, request):
|
def get_context(self, request):
|
||||||
return request
|
return request
|
||||||
|
|
||||||
|
@method_decorator(ensure_csrf_cookie)
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
if request.method.lower() not in ('get', 'post'):
|
if request.method.lower() not in ('get', 'post'):
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -2,7 +2,7 @@ from setuptools import find_packages, setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='graphene-django',
|
name='graphene-django',
|
||||||
version='1.0.dev20160919000002',
|
version='1.0.dev20160919000003',
|
||||||
|
|
||||||
description='Graphene Django integration',
|
description='Graphene Django integration',
|
||||||
long_description=open('README.rst').read(),
|
long_description=open('README.rst').read(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user