python - Passing a variable from view to HTML -
assuming in views.py have variable:
a = 5
and want include information in html page can like:
{%if = 5%} something. {%endif%}
i wondering have pass render_to_response in order value a, or not @ possible?
you can add items context dictionary become available within template. see docs.
def some_view(request): context = { 'a': 5 } return render_to_response( 'my_template.html', context, context_instance=requestcontext(request) )
Comments
Post a Comment