Skip to content

Instantly share code, notes, and snippets.

@sligodave
Created September 28, 2012 15:54
Show Gist options
  • Select an option

  • Save sligodave/3800648 to your computer and use it in GitHub Desktop.

Select an option

Save sligodave/3800648 to your computer and use it in GitHub Desktop.

Revisions

  1. sligodave created this gist Sep 28, 2012.
    23 changes: 23 additions & 0 deletions gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@


    import datetime

    # Time is Central!
    d = datetime.datetime(2012, 9, 26, 14, 00)

    # So we can convert our times to Pacific time
    dt = datetime.timedelta(hours=2)

    from django.contrib.auth.models import User

    # Users who have logged in since that time
    ut = User.objects.filter(last_login__gte=d).order_by('last_login').values_list('username', 'last_login')

    for u, t in ut:
    t = (t-td).isoformat()
    t = t[t.find('T') + 1:]
    t = t[:t.find('.')]
    print t, u1