Created
January 31, 2012 14:46
-
-
Save tokibito/1710862 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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