django-ajax icon indicating copy to clipboard operation
django-ajax copied to clipboard

@csrf_exempt

Open lsemel opened this issue 14 years ago • 2 comments
trafficstars

I'm trying to test my Ajax methods by issuing requests from my browser as I write them, and notice using the decorator @csrf_except around my endpoint function doesn't work, because the function in endpoints.py isn't the real view function, so the decorator has no effect. Any idea how to get around this?

lsemel avatar Jul 05 '11 21:07 lsemel

I was planning on building Django's CSRF tokens into the entire system so that we can use those tokens automatically within the framework. I haven't gotten around to it yet though.

joestump avatar Jul 05 '11 21:07 joestump

You can, however, check for the CSRF stuff by overriding ModelEndpoint.authenticate() and checking the request that's passed to that for CSRF stuff.

joestump avatar Jul 05 '11 21:07 joestump