https://github.com/ebertti/js-csrf-django
Simple javascript to make easy to make POST with AJAX using Django. Based on django documentation
https://github.com/ebertti/js-csrf-django
Last synced: 12 months ago
JSON representation
Simple javascript to make easy to make POST with AJAX using Django. Based on django documentation
- Host: GitHub
- URL: https://github.com/ebertti/js-csrf-django
- Owner: ebertti
- Created: 2012-11-22T22:23:44.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2015-01-26T16:30:03.000Z (over 11 years ago)
- Last Synced: 2025-04-25T12:07:30.568Z (about 1 year ago)
- Language: JavaScript
- Size: 120 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
js-csrf-django
==============
Simple javascript to make easy to make POST with AJAX using Django. Based on django documentation.
Installation
------------
1. Add ``CsrfViewMiddleware`` in your ``MIDDLEWARE_CLASSES`` in ``settings.py`` file of your project.
``` python
MIDDLEWARE_CLASSES = (
...
'django.middleware.csrf.CsrfViewMiddleware',
...
)
```
2. Add the javascript file ``https://raw.github.com/ebertti/js-csrf-django/master/csrf.js`` in the ``head`` of your html page, rather in yout ``base.html``, after jQuery file:
```html
```
3. Now you can make your AJAX request using POST.
[](https://bitdeli.com/free "Bitdeli Badge")