本文整理汇总了Python中vilya.models.user.User.get_new_badges方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_new_badges方法的具体用法?Python User.get_new_badges怎么用?Python User.get_new_badges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vilya.models.user.User
的用法示例。
在下文中一共展示了User.get_new_badges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_user_new_badges
# 需要导入模块: from vilya.models.user import User [as 别名]
# 或者: from vilya.models.user.User import get_new_badges [as 别名]
def test_get_user_new_badges(self):
user = User("qingfeng")
with new_badge(user.username) as badge:
badge.award(item_id=user.username)
eq_(len(user.get_new_badges()), 1)
user.clear_new_badges()
eq_(len(user.get_new_badges()), 0)
示例2: _q_index
# 需要导入模块: from vilya.models.user import User [as 别名]
# 或者: from vilya.models.user.User import get_new_badges [as 别名]
def _q_index(self, request):
name = self.name
your_projects = CodeDoubanProject.get_projects(owner=name, sortby="lru")
actions = get_user_feed(name).get_actions(0, 20)
user = User(name)
teams = Team.get_by_user_id(user.name)
badge_items = user.get_badge_items()
followers_count = user.followers_count
following_count = user.following_count
if user and user.username == name and user.get_new_badges():
user.clear_new_badges()
return st("people.html", **locals())