If your website is massive, the following can cause latency issues(also hang!). Check what the SQL that gets generated using the django-debug-toolbar to get some more cues.
On Mon, Mar 4, 2013 at 7:35 PM, frocco <[email protected]> wrote: > Thanks for your input, I found this on google also. > > def get_all_logged_in_users(): > # Query all non-expired sessions > sessions = Session.objects.filter(expire_date__gte=datetime.now()) > uid_list = [] > > # Build a list of user ids from that query > for session in sessions: > data = session.get_decoded() > uid_list.append(data.get('_auth_user_id', None)) > > # Query all logged in users based on id list > return User.objects.filter(id__in=uid_list) > > > On Sunday, March 3, 2013 11:49:09 AM UTC-5, frocco wrote: >> >> I want to list users currently on our site. >> Would I use the last login date time? >> >> If so, what should the query look like? >> >> Thanks >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.

