django-dajax¶
Dajax is a powerful tool to easily and super-quickly develop asynchronous presentation logic in web applications, using Python and almost no JavaScript source code.
It supports four of the most popular JavaScript frameworks: Prototype, jQuery, Dojo and mootols.
Using django-dajaxice
as communication core, Dajax implements an abstraction layer between presentation logic managed with JavaScript and your Python business logic.
With Dajax you can modify your DOM structure directly from Python.
Documentation¶
How does it work?¶
Example¶
Once you’ve installed dajaxice and dajax you can create ajax functions in your Python code:
from dajax.core import Dajax
def assign_test(request):
dajax = Dajax()
dajax.assign('#box', 'innerHTML', 'Hello World!')
dajax.add_css_class('div .alert', 'red')
return dajax.json()
This function will assign to #box
as innerHTML the text Hello World!
and Hola!
to every DOM element that matches .btn
.
You can call this function in your html/js code using:
<div onclick="Dajaxice.app.assign_test(Dajax.process);">Click Here!</div>
Supported JS Frameworks¶
Dajax currently support four of the most popular: