def most_recent_snippet_for_user(user_email): """Return the most recent snippet for a given user, or None.""" snippets_q = Snippet.all() snippets_q.filter('email = ', user_email) snippets_q.order('-week') # this puts newest snippet first return snippets_q.get()
def snippets_for_user(user_email): """Return all snippets for a given user, oldest snippet first.""" snippets_q = Snippet.all() snippets_q.filter('email = ', user_email) snippets_q.order('week') # this puts oldest snippet first return snippets_q.fetch(1000) # good for many years...