views:

49

answers:

1

django how get session in models or how get session out views

A: 

Assuming that you have the sessions middleware enabled, you can access session as a property of request which is passed into the view:

def my_view(request, *args, **kwargs):
    print request.session['my_session_key']

django doc reference

T. Stone