Skip to content

Instantly share code, notes, and snippets.

View JustOnce's full-sized avatar
💭
Getting things done

Denis Nikanorov JustOnce

💭
Getting things done
View GitHub Profile
@JustOnce
JustOnce / cors.py
Created June 12, 2016 19:54 — forked from miraculixx/cors.py
To enable CORS support in django-tastypie, use the following code snipet. Then create your tastypie resources as a subclass of BaseCorsResource.Basic code courtesy Daniel Conzalez of http://codeispoetry.me/index.php/make-your-django-tastypie-api-cross-domain/.I added documentation and the post_list method.
'''
Add CORS headers for tastypie APIs
Usage:
class MyModelResource(CORSModelResource):
...
class MyResource(CORSResource):
...