Skip to content

Instantly share code, notes, and snippets.

@hanleybrand
Forked from Miserlou/loggedin.py
Created October 12, 2012 20:18
Show Gist options
  • Save hanleybrand/3881279 to your computer and use it in GitHub Desktop.
Save hanleybrand/3881279 to your computer and use it in GitHub Desktop.
Django Filter By Users Last Logged In
{%for u in users%}
{{u}} - {{u.last_login}}<br />
{% endfor %}
# loggedin.py
from django.contrib.auth.models import User
users = User.objects.order_by('-last_login')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment