If you want something that lasts longer than a session (for how-ever
you configured it on your system), then you might consider writing
your own cookie, and checking for it at the relevant places. I don't
use this mechanism for authentication, but as a little additional
personalization touch to remember who's logged in from that browser
previously.
It's not super-obvious, but here's a little snippet example of setting
the cookie:
my_response.set_cookie(key=USER_PERSISTENCE_NAME,
value=username,
max_age=None,
expires=expires,
domain=settings.SESSION_COOKIE_DOMAIN
)
and getting rid of it:
my_response.delete_cookie(USER_PERSISTENCE_NAME)
and to read it, we added a little to a central Context Processor to
make the data available in all the templates:
ctx['saved_username'] = request.COOKIES.get(USER_PERSISTENCE_NAME, "")
On 8/1/07, JHeasly <[EMAIL PROTECTED]> wrote:
>
> Hey James,
>
> This might get you going in the right direction:
>
> "The default 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. ... "
>
> http://code.djangoproject.com/wiki/CookBookDualSessionMiddleware
>
> Hope this helps.
>
> John
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---