def post(self, *args, **kwargs): post_data = get_cleaned_post_data(self, ['weibo',]) user = self.current_user profile = Profile.get_by_user(user) profile.weibo = post_data['weibo'] profile.save() self.write(json_result(0, {'user': user.username}))
def get(self, *args, **kwargs): user = self.current_user profile = Profile.get_by_user(user) userinfo = {} userinfo['username'] = user.username userinfo['weibo'] = profile.weibo self.render('user/profile_edit.html', userinfo=userinfo)
def get(self, user_id, *args, **kwargs): user = User.get(User.id == user_id) profile = Profile.get_by_user(user) posts = Post.select().where(Post.user == user, Post.is_delete == False).limit(10) postreplys = PostReply.select().where(PostReply.user == user).limit(10) collectposts = CollectPost.select().where( CollectPost.user == user).limit(10) who_follow = Follower.select( Follower.follower).where(Follower.user == user) follow_who = Follower.select( Follower.user).where(Follower.follower == user) # 是否显示关注 is_follow = True if Follower.is_follow(user, self.current_user) else False is_online = True if WebsocketChatHandler.is_online( user.username) else False self.render('user/profile.html', user=user, who_follow=who_follow, follow_who=follow_who, profile=profile, posts=posts, postreplys=postreplys, is_follow=is_follow, is_online=is_online, collectposts=collectposts)
def get(self, *args, **kwargs): user = self.current_user profile = Profile.get(Profile.user == user) notifications = Notification.select().where(Notification.user == user) self.render('user/profile_notification.html', profile=profile, notifications=notifications, )
def get(self, *args, **kwargs): user = self.current_user profile = Profile.get(Profile.user == user) notifications = Notification.select().where(Notification.user == user) self.render( 'user/profile_notification.html', profile=profile, notifications=notifications, )
def post(self, *args, **kwargs): post_data = get_cleaned_post_data(self, [ 'weibo', ]) user = self.current_user profile = Profile.get_by_user(user) profile.weibo = post_data['weibo'] profile.save() self.write(json_result(0, {'user': user.username}))
def get(self, user_id, *args, **kwargs): user = User.get(User.id == user_id) who_follow = Follower.select(Follower.follower).where(Follower.user == user) follow_who = Follower.select(Follower.user).where(Follower.follower == user) profile = Profile.get_by_user(user) is_follow = Follower.is_follow(user, self.current_user) self.render('user/profile_follower.html', user=user, profile=profile, who_follow=who_follow, follow_who=follow_who, is_follow=is_follow)
def get(self, user_id, *args, **kwargs): user = User.get(User.id == user_id) who_follow = Follower.select( Follower.follower).where(Follower.user == user) follow_who = Follower.select( Follower.user).where(Follower.follower == user) profile = Profile.get_by_user(user) is_follow = Follower.is_follow(user, self.current_user) self.render('user/profile_follower.html', user=user, profile=profile, who_follow=who_follow, follow_who=follow_who, is_follow=is_follow)
def get(self, user_id, *args, **kwargs): user = User.get(User.id == user_id) profile = Profile.get_by_user(user) posts = Post.select().where(Post.user == user).limit(10) postreplys = PostReply.select().where(PostReply.user == user).limit(10) collectposts = CollectPost.select().where( CollectPost.user == user).limit(10) # 是否显示关注 is_follow = Follower.is_follow(user, self.current_user) self.render('user/profile.html', user=user, profile=profile, posts=posts, postreplys=postreplys, is_follow=is_follow, collectposts=collectposts)
def get(self, user_id, *args, **kwargs): user = User.get(User.id == user_id) profile = Profile.get_by_user(user) posts = Post.select().where(Post.user == user, Post.is_delete == False).limit(10) postreplys = PostReply.select().where(PostReply.user == user).limit(10) collectposts = CollectPost.select().where(CollectPost.user == user).limit(10) who_follow = Follower.select(Follower.follower).where(Follower.user == user) follow_who = Follower.select(Follower.user).where(Follower.follower == user) # 是否显示关注 is_follow = True if Follower.is_follow(user, self.current_user) else False is_online = True if WebsocketChatHandler.is_online(user.username) else False self.render('user/profile.html', user=user, who_follow=who_follow, follow_who=follow_who, profile=profile, posts=posts, postreplys=postreplys, is_follow=is_follow, is_online=is_online, collectposts=collectposts)