cbmi/serrano — pull request #240 by rv816 (2014-11-24 23:25:03+00:00)
Title: Added @csrf_protect decorator from django.views.decorators.csrf to resol...

...ve csrf_token errorHoly shit. I actually fixed it. Holy shit.

It was actually a problem in Serrano’s code, for some reason., in serrano.tokens. I added the @csrf_protect decorator from django.views.decorators.csrf

I initially got this error when trying to Apply filter.:
[24/Nov/2014 16:17:19] "POST /api/contexts/ HTTP/1.1" 403 1147

This was the page loaded in devtools.
![image](https://cloud.githubusercontent.com/assets/3758548/5175217/8f8a3b5e-7406-11e4-827b-be7eae5ce050.png)

…Following the docs referenced ultimately led me here (click around and scroll down a bit. Docs below are for Django 1.5.

![image](https://cloud.githubusercontent.com/assets/3758548/5175221/9980e374-7406-11e4-88c2-c3eb01f072b3.png)

For whatever reason, the app wasn’t sending the token with its POST requests:

Before:
![image](https://cloud.githubusercontent.com/assets/3758548/5175230/bae3cfae-7406-11e4-8d3e-0aa036fa6f36.png)

I traced the origin of the post requests to serrano, in tokens.py file (serrano.tokens)

![pastedgraphic-8](https://cloud.githubusercontent.com/assets/3758548/5175258/ded9dfe8-7406-11e4-9efb-bdb8fcee4fe1.png)
Before:

That matched the error described in the django docs above. I added the decorator:

**After:**
![pastedgraphic-6](https://cloud.githubusercontent.com/assets/3758548/5175265/f1008abe-7406-11e4-8cd7-ff5f7945639a.png)

And the problem was resolved.

![pastedgraphic-9](https://cloud.githubusercontent.com/assets/3758548/5175240/ce08a370-7406-11e4-9f68-63e51a047292.png)

![image](https://cloud.githubusercontent.com/assets/3758548/5175282/19a60d5e-7407-11e4-8203-68216cbab71f.png)