def card_info(request): user_or_team_id = request.get_form_var('user') team = Team.get_by_uid(user_or_team_id) user_existed = User.check_exist(user_or_team_id) if not team or user_existed: user = User(user_or_team_id) data = { 'user': {'name': user_or_team_id, 'avatar': user.avatar_url, 'url': user.url, 'badges': [{'img': item.badge.get_image_url(), 'name': item.badge.name, 'reason': item.reason or item.badge.summary} for item in user.get_badge_items()]} } else: members = team.user_ids[::-1] # 根据团队的时间排序 displayed_users = [User(uid) for uid in team.user_ids[:8]] data = { 'team': { 'id': team.uid, 'name': team.name, 'url': team.url, 'desc': team.short_description, 'profile_url': team.profile_url(), 'members': [{'uid': u.name, 'avatar_url': u.avatar_url} for u in displayed_users], 'member_count': len(members) } } return json.dumps(data)
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())
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())
def card_info(request): user_or_team_id = request.get_form_var('user') team = Team.get_by_uid(user_or_team_id) user_existed = User.check_exist(user_or_team_id) if not team or user_existed: user = User(user_or_team_id) data = { 'user': { 'name': user_or_team_id, 'avatar': user.avatar_url, 'url': user.url, 'badges': [{ 'img': item.badge.get_image_url(), 'name': item.badge.name, 'reason': item.reason or item.badge.summary } for item in user.get_badge_items()] } } else: members = team.user_ids[::-1] # 根据团队的时间排序 displayed_users = [User(uid) for uid in team.user_ids[:8]] data = { 'team': { 'id': team.uid, 'name': team.name, 'url': team.url, 'desc': team.short_description, 'profile_url': team.profile_url(), 'members': [{ 'uid': u.name, 'avatar_url': u.avatar_url } for u in displayed_users], 'member_count': len(members) } } return json.dumps(data)