https://github.com/webix-hub/python-django-demo
Using Django with Webix UI
https://github.com/webix-hub/python-django-demo
django python webix webix-backend
Last synced: 4 months ago
JSON representation
Using Django with Webix UI
- Host: GitHub
- URL: https://github.com/webix-hub/python-django-demo
- Owner: webix-hub
- Created: 2017-05-02T12:35:14.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-27T13:21:02.000Z (almost 8 years ago)
- Last Synced: 2025-04-14T13:02:17.792Z (about 1 year ago)
- Topics: django, python, webix, webix-backend
- Language: Python
- Size: 9.77 KB
- Stars: 5
- Watchers: 3
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Using Django with Webix UI
===========================
Initialization
--------------
```
python manage.py migrate
python manage.py loaddata film
python manage.py loaddata runserver
```
Open http://localhost:8000/datatable in a browser
How it works
--------------
Server side code defines a simple REST handler, which outputs data from related model and process changes (datatable/views.py:data)
For data fetching handler returns an array of objects. For data saving handler returns a JSON object which can contain a new record id ( useful for insert operations ) or any other custom properties.
#### CSRF
Client side code need to have the next block of a code to provide correct CSRF headers
```html
{% csrf_token %}
webix.attachEvent("onBeforeAjax", function(mode, url, data, xhr, headers){
var key = document.querySelector("[name=csrfmiddlewaretoken]").value;
headers["X-CSRFToken"] = key;
});
```
License
---------
MIT