本文整理汇总了Python中biostar.apps.posts.models.Post.thread_score方法的典型用法代码示例。如果您正苦于以下问题:Python Post.thread_score方法的具体用法?Python Post.thread_score怎么用?Python Post.thread_score使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类biostar.apps.posts.models.Post
的用法示例。
在下文中一共展示了Post.thread_score方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_post
# 需要导入模块: from biostar.apps.posts.models import Post [as 别名]
# 或者: from biostar.apps.posts.models.Post import thread_score [as 别名]
def get_post(row, users):
uid = get(row, 'id', func=int)
root_id = get(row, 'root_id', func=int)
parent_id = get(row, 'parent_id', func=int)
title = get(row, 'title').title()
tag_val = get(row, 'tag_val').strip()
author_id = get(row, 'author_id', func=int)
author = users.get(author_id)
if not author:
print("*** author %s not found for post %s" % (author_id, uid))
return None
post_type = get(row, 'post_type')
post_type = POST_TYPE_MAP.get(post_type, Post.FORUM)
post_status = Post.OPEN if get(row, 'post_status') == "Open" else Post.CLOSED
post = Post(id=uid, title=title, author=author, lastedit_user=author,
parent_id=parent_id, root_id=root_id)
post.status = post_status
post.type = post_type
post.tag_val = ",".join(tag_val.split())
post.creation_date = localize_time(get(row, 'creation_date'))
post.lastedit_date = localize_time(get(row, 'lastedit_date'))
post.view_count = get(row, "views", func=int)
post.reply_count = get(row, "answer_count", func=int)
post.book_count = get(row, "book_count", func=int)
post.thread_score = get(row, "full_score", func=int)
post.vote_count = get(row, "score", func=int)
post_file = path_join(MIGRATE_DIR, 'posts', str(uid))
post.content = file(post_file, 'rt').read()
return post