本文整理匯總了Python中server.models.shift.Shift.count_by_user_and_published方法的典型用法代碼示例。如果您正苦於以下問題:Python Shift.count_by_user_and_published方法的具體用法?Python Shift.count_by_user_and_published怎麽用?Python Shift.count_by_user_and_published使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類server.models.shift.Shift
的用法示例。
在下文中一共展示了Shift.count_by_user_and_published方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: info
# 需要導入模塊: from server.models.shift import Shift [as 別名]
# 或者: from server.models.shift.Shift import count_by_user_and_published [as 別名]
def info(self):
from server.models.follow import Follow
from server.models.shift import Shift
# TODO: use the bulk API - David 12/10/09
result = {}
db = core.connect()
shared = core.connect("shiftspace/shared")
result["followerCount"] = core.value(Follow.followers_count(db, key=self.id)) or 0
result["followingCount"] = core.value(Follow.following_count(db, key=self.id)) or 0
result["publishedShiftCount"] = core.value(Shift.count_by_user_and_published(shared, key=self.id)) or 0
return result