Created
July 19, 2011 14:57
-
-
Save 1stvamp/1092652 to your computer and use it in GitHub Desktop.
Re-init Django session from GET value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Sometimes you just want to load your session based on a GET value, | |
without having an entire middleware installed to do it everytime, e.g. | |
just do it quickly in a view. | |
""" | |
def test_view(request): | |
# Assuming session key sent as 'sessionid' value in querystring | |
request.session = request.session.__class__(session_key=request.GET['sessionid']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment