[Answer]-How to use django object in session

1👍

session uses the standard Python dictionary interface, so you want either:

if 'character' in request.session:
    print request.session['character'].name
else:
    print "nothing to see here"

Or, in some cases, request.session.get('character') if you just want to have a default value if the key is not present.

Leave a comment