Skip to content

Instantly share code, notes, and snippets.

@tokibito
Created January 31, 2012 14:46
Show Gist options
  • Save tokibito/1710862 to your computer and use it in GitHub Desktop.
Save tokibito/1710862 to your computer and use it in GitHub Desktop.
from google.appengine.ext import db
class User(db.Model):
nickname = db.StringProperty()
class Comment(db.Model):
user = db.ReferenceProperty(User)
text = db.StringProperty()
def get_commented_user_nicknames_1():
return [comment.user.nickname for comment in Comment.all()]
def get_commented_user_nicknames_2():
user_keys = [comment._user for comment in Comment.all()]
users = db.get(user_keys)
return [user.nickname for user in users]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment