Last active
July 28, 2016 06:30
-
-
Save ghoshabhi/9d016c1c6f94ce0cbe7cfa6a7d83a979 to your computer and use it in GitHub Desktop.
This file contains 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
def sampleJoin(): | |
posts = Post.query(Post.is_draft == False).order(-Post.created) | |
all_users = User.query() | |
list_dict = [] | |
for p in posts: | |
p_dict = {} | |
for u in all_users: | |
if p.user == u.key: | |
p_dict['p_id'] = p.key.id() | |
p_dict['p_title'] = p.title | |
p_dict['p_content'] = p.content | |
p_dict['p_created'] = p.created | |
p_dict['a_name'] = u.fullname | |
p_dict['a_key'] = u.key | |
p_dict['a_id'] = u.key.id() | |
list_dict.append(p_dict) | |
return list_dict |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment