I'm new to Python and currently working on my first Google App Engine application. In my program I have an 'Inbox' database model which contains string proporties like to_user, from_user, title, content, etc. When a user logs in to my app I want to be able to count the number of messages that were sent to him/her, this way I can display it as "New Messages(x)". I feel like I currently am using a work around because I can't find a better way.
user = users.get_current_user()
inbox = Inbox.gql('WHERE to_user = :to_user', to_user=user.nickname())
count = 0
for note in inbox:
count = count+1
I tried using len(inbox) but that gave me an error. Thanks for your time.