Monday, March 4, 2013

Re: Is there a way to list users that have logged in within the pass 30 minutes

So are you saying the best I can do is show users that logged in xx minutes ago, even through they may have logged off?

Thank you

On Monday, March 4, 2013 1:06:07 PM UTC-5, Shawn Milochik wrote:
On Mon, Mar 4, 2013 at 1:02 PM, frocco <far...@gmail.com> wrote:
> ok, do you have a better idea on how I might do this?
> user is used to seeing this from a PHP site that I am porting.
>

I use this at the shell sometimes:

from django.contrib.auth.models import User
for user in User.objects.order_by('-last_login')[:25].iterator():
    print user.username.ljust(20, ' '), user.get_full_name().ljust(30,
' '), user.last_login

Just alter the queryset to use a timedelta query for last_login
instead of a row limit. Shouldn't be a big load on the system.

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate