Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Commit

Permalink
disable csrf_protect in api
Browse files Browse the repository at this point in the history
  • Loading branch information
ichuan committed Jan 30, 2012
1 parent b99a756 commit 771f09f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/views.py
Expand Up @@ -6,6 +6,7 @@
import re
from django.http import HttpResponse, HttpRequest
from django.contrib.auth import authenticate
from django.views.decorators.csrf import csrf_view_exempt
from todo.models import Todo, Tag, User
from utils import json_encode, json_decode, now, date_range

Expand Down Expand Up @@ -60,7 +61,7 @@ def inner(*a, **b):
return ret if raw else json_return(ret)
except:
return -1 if raw else json_return(status=500)
return inner
return csrf_view_exempt(inner)

@api
def test(method, get, post, user):
Expand Down
1 change: 1 addition & 0 deletions settings.py
Expand Up @@ -80,6 +80,7 @@
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
Expand Down

0 comments on commit 771f09f

Please sign in to comment.