[Answered ]-How To Share Information Between Django and Javascript?

2👍

… one cannot use django template tags in the javascript code unless the code is embedded into the HTML itself …

This is incorrect. Simply make the <script> tag point to something in your urlconf, then have the view set the Content-Type header appropriately for JavaScript and output it.

0👍

I just setup a few datatables last week with Django.
The only requirement is that your server sends a JSON structure called aaData, containing the rows.

You can also use this full example as a basis, this is more advanced and has a few methods you have to cipy in your projects (datatables.utils) :
http://www.datatables.net/development/server-side/django

Leave a comment