本文整理匯總了Python中users.Users.get_user_extension方法的典型用法代碼示例。如果您正苦於以下問題:Python Users.get_user_extension方法的具體用法?Python Users.get_user_extension怎麽用?Python Users.get_user_extension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類users.Users
的用法示例。
在下文中一共展示了Users.get_user_extension方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_category_info
# 需要導入模塊: from users import Users [as 別名]
# 或者: from users.Users import get_user_extension [as 別名]
def get_category_info(category):
result = Objects.get_object_info(category)
owners = list()
for owner in category.owners.all():
user_extension = Users.get_user_extension(owner.username)
if user_extension:
owners.append(Users.get_user_info(user_extension))
result["owners"] = owners
return result
示例2: get_post_win_count_by_user
# 需要導入模塊: from users import Users [as 別名]
# 或者: from users.Users import get_user_extension [as 別名]
def get_post_win_count_by_user(user_id):
try:
user = Users.get_user_by_id(user_id)
user_extension = Users.get_user_extension(user.username)
count = 0
for fp in ForumPost.objects.all():
if user_extension in fp.win_users.all():
count += 1
return count
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return 0