def get_post_replies(post_id): reply_id_dict = db.get_columns('PostReplies', post_id) replies = [] for key in reply_id_dict.keys(): reply = Post.objects.get(key.get_hex()) replies.append(reply) return replies
def get_place_posts(place_id, before, max_count): if (before) or (len(before) == 0): start_column = "" else: start_column = uuid.UUID(before) post_id_dict = db.get_columns(IdxCF.IDX_PLACE_POSTS, place_id, column_start=start_column, column_count=max_count) return [Post.objects.get(id=key) for key in post_id_dict.keys()];
def new_post(post): post.create_date = datetime.utcnow() post.save() db.set_column_value(IdxCF.IDX_PLACE_POSTS, post.place_id, uuid.UUID(post.id), '') db.set_column_value(IdxCF.IDX_USER_POSTS, post.user_id, uuid.UUID(post.id), '') followed_count = db.get_column_count(IdxCF.IDX_PLACE_FOLLOWED_USERS, post.place_id) if followed_count > 0: user_id_dict = db.get_columns(IdxCF.IDX_PLACE_FOLLOWED_USERS, post.place_id, column_count=followed_count) for user_id in user_id_dict.keys(): db.set_column_value(IdxCF.IDX_USER_TIMELINE, str(user_id), uuid.UUID(post.id), '')