Accessing session variable in Django template with Google App Engine (Webapp) - Python -
i have django template front-end. @ back-end, used sessions provided gaeutilities store variable (email).
front-end:
{% if session.email %} <div id="entersite">welcome <em>{{session.email}}</em></div> {% else %} <div id= "entersite"><a href="/login/" id= "entersite">enter site</a></div> {% endif %}
back-end:
self.session = session() self.session['email'] = email temp = os.path.join(os.path.dirname(__file__),'templates/index.htm') outstr = template.render(temp, {}) self.response.out.write(outstr)
problem: how access stored session on server side , use on django template (front-end)?
anybody can give update on qns?
you need set session object in django template context, no?
template.render(temp, {'session':self.session})
Comments
Post a Comment