def get_sidebar_arguments(self): '''得到两侧栏的render变量''' user_id = self.current_user['_id'] status_number = yield StatusDocument.get_status_number(user_id) topic_number = yield TopicDocument.get_topic_number_by_someone(user_id) user_setting = yield UserSettingDocument.find_one({ 'user': DBRef(UserDocument.meta['collection'], ObjectId(user_id)) }) random_user_list = yield UserDocument.get_random_user_list( self.current_user['_id'] ) kwargs = { 'status_number': status_number, 'topic_number': topic_number, 'MessageTopic': MessageTopic, 'user_setting': user_setting, 'random_user_list': random_user_list, 'HOME_SETTINGS': HOME_SETTINGS } raise gen.Return(kwargs)
def get(self, user_id=None): user_id = user_id or self.current_user['_id'] kwargs = yield self.get_header_arguments(user_id) if not kwargs['can_seen']: self.render('profile/template/profile-visitor.html', **kwargs) else: status_list = yield StatusDocument.get_status_list( user_id, self.current_user['_id'], limit=PROFILE_SETTINGS['status_number_per_page']) recommend_friend_list = yield UserDocument.get_random_user_list( self.current_user['_id']) if kwargs['user']['user_type'] == 'league': member_list = yield LeagueMemberDocument.get_member(user_id) kwargs.update({'member_list': member_list}) kwargs.update({ 'status_list': status_list, 'recommend_friend_list': recommend_friend_list, 'PROFILE_SETTINGS': PROFILE_SETTINGS }) self.render('profile/template/status/status.html', **kwargs)
def get(self, user_id=None): user_id = user_id or self.current_user['_id'] kwargs = yield self.get_header_arguments(user_id) if not kwargs['can_seen']: self.render('profile/template/profile-visitor.html', **kwargs) else: status_list = yield StatusDocument.get_status_list( user_id, self.current_user['_id'], limit=PROFILE_SETTINGS['status_number_per_page'] ) recommend_friend_list = yield UserDocument.get_random_user_list( self.current_user['_id'] ) if kwargs['user']['user_type'] == 'league': member_list = yield LeagueMemberDocument.get_member(user_id) kwargs.update({'member_list': member_list}) kwargs.update({ 'status_list': status_list, 'recommend_friend_list': recommend_friend_list, 'PROFILE_SETTINGS': PROFILE_SETTINGS }) self.render('profile/template/status/status.html', **kwargs)
def get_sidebar_arguments(self): '''得到两侧栏的render变量''' user_id = self.current_user['_id'] status_number = yield StatusDocument.get_status_number(user_id) topic_number = yield TopicDocument.get_topic_number_by_someone(user_id) user_setting = yield UserSettingDocument.find_one({ 'user': DBRef(UserDocument.meta['collection'], ObjectId(user_id)) }) random_user_list = yield UserDocument.get_random_user_list( self.current_user['_id'] ) kwargs = { 'status_number': status_number, 'topic_number': topic_number, 'MessageTopic': MessageTopic, 'user_setting': user_setting, 'random_user_list': random_user_list, 'HOME_SETTINGS': HOME_SETTINGS } raise gen.Return(kwargs)
def post(self): recommend_friend_list = yield UserDocument.get_random_user_list( self.current_user['_id']) html = self.render_string( 'profile/template/status/friend-recommend.html', recommend_friend_list=recommend_friend_list) self.finish(json.dumps({'html': html}))
def post(self): '''换一批推荐''' random_user_list = yield UserDocument.get_random_user_list( self.current_user['_id']) html = self.render_string('home/template/friend-recommend.html', random_user_list=random_user_list) self.write_json({'html': html})
def post(self): recommend_friend_list = yield UserDocument.get_random_user_list( self.current_user['_id'] ) html = self.render_string( 'profile/template/status/friend-recommend.html', recommend_friend_list=recommend_friend_list ) self.write_json({'html': html})
def post(self): '''换一批推荐''' random_user_list = yield UserDocument.get_random_user_list( self.current_user['_id'] ) html = self.render_string( 'home/template/friend-recommend.html', random_user_list=random_user_list ) self.write_json({'html': html})