本文整理匯總了Python中mygpo.users.models.User.view方法的典型用法代碼示例。如果您正苦於以下問題:Python User.view方法的具體用法?Python User.view怎麽用?Python User.view使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mygpo.users.models.User
的用法示例。
在下文中一共展示了User.view方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: deleted_users
# 需要導入模塊: from mygpo.users.models import User [as 別名]
# 或者: from mygpo.users.models.User import view [as 別名]
def deleted_users():
from mygpo.users.models import User
users = User.view('users/deleted',
include_docs = True,
reduce = False,
)
return list(users)
示例2: handle
# 需要導入模塊: from mygpo.users.models import User [as 別名]
# 或者: from mygpo.users.models.User import view [as 別名]
def handle(self, *args, **options):
users = User.view("users/deleted", include_docs=True, reduce=False)
total = User.view("users/deleted", reduce=True)
total = list(total)[0]["value"] if total else 0
for n, user in enumerate(users):
if user.is_active or not user.deleted:
print "skipping", user.username
print "deleting", user.username,
user.delete()
progress(n + 1, total)
示例3: user_agent_stats
# 需要導入模塊: from mygpo.users.models import User [as 別名]
# 或者: from mygpo.users.models.User import view [as 別名]
def user_agent_stats():
from mygpo.users.models import User
res = User.view('clients/by_ua_string',
wrap_doc = False,
group_level = 1,
stale = 'update_after',
)
return Counter(dict((r['key'], r['value']) for r in res))
示例4: get_entries
# 需要導入模塊: from mygpo.users.models import User [as 別名]
# 或者: from mygpo.users.models.User import view [as 別名]
def get_entries(self):
if self._useragents is None:
res = User.view('clients/by_ua_string',
wrap_doc = False,
group_level = 1,
stale = 'update_after',
)
self._useragents = Counter(dict((r['key'], r['value']) for r in res))
return self._useragents
示例5: user_by_google_email
# 需要導入模塊: from mygpo.users.models import User [as 別名]
# 或者: from mygpo.users.models.User import view [as 別名]
def user_by_google_email(email):
""" Get a user by its connected Google account """
from mygpo.users.models import User
users = User.view('users/by_google_email',
key = email,
include_docs = True,
)
if not users:
return None
return users.one()
示例6: deleted_user_count
# 需要導入模塊: from mygpo.users.models import User [as 別名]
# 或者: from mygpo.users.models.User import view [as 別名]
def deleted_user_count():
from mygpo.users.models import User
total = User.view('users/deleted',
reduce = True,
)
return list(total)[0]['value'] if total else 0