本文整理汇总了Python中website.project.model.User.find方法的典型用法代码示例。如果您正苦于以下问题:Python User.find方法的具体用法?Python User.find怎么用?Python User.find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类website.project.model.User
的用法示例。
在下文中一共展示了User.find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_active_user_count
# 需要导入模块: from website.project.model import User [as 别名]
# 或者: from website.project.model.User import find [as 别名]
def get_active_user_count(time):
query = (
Q('date_registered', 'lt', time) &
Q('is_registered', 'eq', True) &
Q('password', 'ne', None) &
Q('merged_by', 'eq', None) &
Q('date_confirmed', 'ne', None) &
Q('date_disabled', ' eq', None)
)
return User.find(query).count()
示例2: revoke_oauth_access
# 需要导入模块: from website.project.model import User [as 别名]
# 或者: from website.project.model.User import find [as 别名]
def revoke_oauth_access(self, external_account, auth, save=True):
"""Revoke all access to an ``ExternalAccount``.
TODO: This should accept node and metadata params in the future, to
allow fine-grained revocation of grants. That's not yet been needed,
so it's not yet been implemented.
"""
for node in self.get_nodes_with_oauth_grants(external_account):
try:
node.get_addon(external_account.provider, deleted=True).deauthorize(auth=auth)
except AttributeError:
# No associated addon settings despite oauth grant
# Remove grant in `for` loop below
pass
if User.find(Q('external_accounts', 'eq', external_account._id)).count() == 1:
# Only this user is using the account, so revoke remote access as well.
self.revoke_remote_oauth_access(external_account)
for key in self.oauth_grants:
self.oauth_grants[key].pop(external_account._id, None)
if save:
self.save()
示例3: get_unregistered_users
# 需要导入模块: from website.project.model import User [as 别名]
# 或者: from website.project.model.User import find [as 别名]
def get_unregistered_users():
query = (
Q('is_registered', 'eq', False)
)
return User.find(query).count()
示例4: get_all_user_count
# 需要导入模块: from website.project.model import User [as 别名]
# 或者: from website.project.model.User import find [as 别名]
def get_all_user_count(time):
query = Q('date_registered', 'lt', time)
return User.find(query).count()
示例5: get_queryset
# 需要导入模块: from website.project.model import User [as 别名]
# 或者: from website.project.model.User import find [as 别名]
def get_queryset(self):
query = (
Q('system_tags', 'eq', self.SPAM_TAG)
)
return User.find(query).sort(self.ordering)
示例6: find_user_by_family_name
# 需要导入模块: from website.project.model import User [as 别名]
# 或者: from website.project.model.User import find [as 别名]
def find_user_by_family_name(family_name):
user_list = User.find(Q('family_name', 'eq', family_name))
return user_list[0] if user_list.count() == 1 else None