divio/django-cms — pull request #1714 by harrastia (2013-04-17 18:01:21+00:00)
Title: Fix to allow javascript catch the right CSRF_COOKIE_NAME. Issue #1713

* Added javascript global variable `__csrf_cookie_name__`, it will
be displayed only in admin views and when the toolbar is available
so it doesn't expose this variable in the public version of the pages
* Fixed the javascript code where the 'csrftoken' string is hardcoded.
* Modified views and templates to pass to the context the
CSRF_COOKIE_NAME and use it to set the value of the global javascript
variable `window.__csrf_cookie_name__` falling back to the default
'csrftoken' value

The solution is not very clean, this is open to suggestions to improve the code and also how to test this functionality.