本文整理匯總了Python中core.models.User.select方法的典型用法代碼示例。如果您正苦於以下問題:Python User.select方法的具體用法?Python User.select怎麽用?Python User.select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core.models.User
的用法示例。
在下文中一共展示了User.select方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: system_users
# 需要導入模塊: from core.models import User [as 別名]
# 或者: from core.models.User import select [as 別名]
def system_users():
user = auth.is_logged_in(request)
permission = auth.is_sys_admin(user)
return listing(request, None, User.select(),
'system_users', 'system_manage_users',
user=user)
示例2: get_users_with_permission
# 需要導入模塊: from core.models import User [as 別名]
# 或者: from core.models.User import select [as 別名]
def get_users_with_permission(level):
permissions = Permission.select(Permission.user).where(
Permission.permission == level)
users_with_permissions = User.select().where(
User.id << permissions)
return users_with_permissions
示例3: author_context
# 需要導入模塊: from core.models import User [as 別名]
# 或者: from core.models.User import select [as 別名]
def author_context(fileinfo, original_page, tag_context, date_counter):
if fileinfo is None:
author_context = [original_page.author]
else:
author_context = [fileinfo.author]
author_limiter = User.select().where(User.id == author_context)
tag_context_next = tag_context.select().where(Page.user << author_limiter)
return tag_context_next, date_counter
示例4: system_context
# 需要導入模塊: from core.models import User [as 別名]
# 或者: from core.models.User import select [as 別名]
def system_context(user_to_edit=None, path='basic'):
try:
root_path = '/system/user/{}'.format(user_to_edit.id)
except AttributeError:
root_path = ''
return master_context(User.select(), path, root_path)