python - Access sessions in Template using Django 1.1.4 -
i have created session in view. have called in template. throws error stating invalid syntax. have checked settings.py , under middleware_classes session enabled. when ever run page throws error. please see below
views.py
request.session["name"] = "name" return render_to_response('index.html',context_instance = requestcontext(request,{'session':'name'})
index.html
{{ request.session.name }}
if posted code correctly missing closing parentheses render_to_response
return render_to_response('index.html',context_instance = requestcontext(request,{'session':'name'}))
Comments
Post a Comment