If you are using default Django sessions, they will be stored in the database.
>From the docs:
By default, Django stores sessions in your database (using the model
django.contrib.sessions.models.Session). Though this is convenient, in
some setups it's faster to store session data elsewhere, so Django can
be configured to store session data on your filesystem or in your
cache.
>>> from django.contrib.sessions.models import Session
>>> Session.objects.all()
[<Session: Session object>, <Session: Session object>, <Session:
Session object>, <Session: Session object>, <Session: Session object>,
<Session: Session object>, <Session: Session object>, <Session:
Session object>, <Session: Session object>, <Session: Session object>,
<Session: Session object>, <Session: Session object>, <Session:
Session object>, <Session: Session object>, <Session: Session object>,
<Session: Session object>, <Session: Session object>, <Session:
Session object>, <Session: Session object>, <Session: Session object>,
'...(remaining elements truncated)...']
>>> Session.objects.all()[0].get_decoded()
{'_auth_user_id': 1L, '_auth_user_backend':
'django.contrib.auth.backends.ModelBackend'}
On Sat, Feb 21, 2009 at 12:27 PM, Tim <[email protected]> wrote:
>
> Hi -
>
> I am using the Django auth backend and I'd like to test which users
> are currently logged in. I can't do this just by grabbing
> User.objects.all() and testing each with is_authenticated, because the
> User objects being User objects as opposed to AnonymousUser objects
> will always return True for is_authenticated. Can anyone point me to
> the right way to do this?
>
> - Tim
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---