MozSecureWorld FAQ: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Created page with "= MozSecureWorld FAQ/Notes = == FAQ == === CSRF error === Django's fix to CSRF can be found in [https://docs.djangoproject.com/en/dev/intro/tutorial04/ the tutorial]. Where you p...")
 
Line 26: Line 26:
<pre>
<pre>
import jingo
import jingo
     rendered = jingo.render(request, 'template.html', {"var_name": var_value})
     return jingo.render(request, 'template.html', {"var_name": var_value})
</pre>
</pre>

Revision as of 01:47, 14 June 2011

MozSecureWorld FAQ/Notes

FAQ

CSRF error

Django's fix to CSRF can be found in the tutorial. Where you put in

template.html:

{% csrf_token %}


views.py:

from django.shortcuts import render_to_response
from django.template import RequestContext
def ...
    return render_to_response('template.html', {'var_name': var_value}, context_instance=RequestContext(request))

But in the demo's setup with jingo and other stuff: template.html:

{{ csrf() }}

views.py:

import jingo
    return jingo.render(request, 'template.html', {"var_name": var_value})