0

How do I apply a GQL query such that it lists the user_name in the UserInformation model table of those who have logged in within the last 3 days?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Mayur
  • 1
  • 1

1 Answers1

4

I am presuming UserInformation is your own class, it is not part of any App Engine model that I know and you are using python.

You won't be able to return just a list of user_names, you will get a collection of UserInformation model instances.

Do you have a last login date property in your model? If yes, then the following should work.

three_days_ago = datetime.datetime.now() - datetime.timedelta(days = 3)
users = db.Query(UserInformation).filter("login_date >", three_days_ago).fetch(10)
Kinlan
  • 16,315
  • 5
  • 56
  • 88