Changes between Version 8 and Version 9 of CookBookDualSessionMiddleware
- Timestamp:
- Oct 30, 2008, 8:02:18 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CookBookDualSessionMiddleware
v8 v9 1 '''Obsoleted by Django 1.0:''' Django 1.0's session object introduced a set_expiry() method, which can be used to set the expiration policy on a per-session basis. To implement "remember me" functionality, simply configure whatever default session length you prefer in your settings.py, and after user login call request.session.set_expiry with some large number of seconds if the user has checked the "remember me" box. No extra middleware is needed. 2 3 See http://docs.djangoproject.com/en/dev/topics/http/sessions/ for detailed session docs. 4 5 ---- 6 1 7 The default [http://www.djangoproject.com/documentation/sessions/ SessionMiddleware] that comes with Django lets you pick if you want all sessions to be browser-length or persistent, if you want to use different types of sessions based on a users preference (e.g. the good old "Remember Me" check-box) you're gonna have to write your own middleware. Fortunately it's pretty easy, this page documents my attempt, I don't like the "!DualSession" name much, but it's the best I could come up with. 2 8