本文整理汇总了Python中models.user.User.get_all_focuson方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_all_focuson方法的具体用法?Python User.get_all_focuson怎么用?Python User.get_all_focuson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.user.User
的用法示例。
在下文中一共展示了User.get_all_focuson方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_all_focuson [as 别名]
def get(self):
uname = self.get_current_user()
user = User.get_user_by_name(uname)
uid = self.get_argument("uid", None)
Vuser = User.get_user_by_id(uid)
fans = self.get_argument("fans", None)
F = False
u = "Ta"
if len(Vuser)>0:
if len(user)>0:
if Vuser[0].uid == user[0].uid:
u = "我"
focus = User.get_all_focuson(user[0].uid)
if len(focus)>0:
for one in focus:
if one.uid == Vuser[0].uid:
F = True
break
Vfans = User.get_all_fans(Vuser[0].uid)
Vfocus = User.get_all_focuson(Vuser[0].uid)
self.render("focus.html",fans=fans,u=u,F=F,user=user,Vuser=Vuser,Vfans=Vfans,Vfocus=Vfocus)
else:
self.redirect("/")
示例2: get
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_all_focuson [as 别名]
def get(self):
aid = self.get_argument("aid")
uname = self.get_current_user()
user = User.get_user_by_name(uname)
article = Article.get_by_aid(aid)
F = False
if len(article)>0:
if len(user)>0:
focus = User.get_all_focuson(user[0].uid)
if len(focus)>0:
for one in focus:
if one.uid == article[0].uid:
F = True
break
writer = User.get_user_by_id(article[0].uid)
comments = Comment.get_all_comments(article[0].aid,200)
Article.add_one_nvisit(aid)
self.render("article.html",user=user,writer=writer,article=article,comments=comments,F=F)
示例3: get
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_all_focuson [as 别名]
def get(self):
uname = self.get_current_user()
user = User.get_user_by_name(uname)
Vuid = self.get_argument("uid",None)
Vuser = User.get_user_by_id(Vuid)
F = False
U = False
if len(Vuser)>0:
if len(user)>0:
if Vuser[0].uid == user[0].uid:
U = True
focus = User.get_all_focuson(user[0].uid)
if len(focus)>0:
for one in focus:
if one.uid == Vuser[0].uid:
F = True
break
if not U:
User.add_one_nvisit(Vuser[0].uid)
article = Article.get_by_uid(Vuser[0].uid)
Acard = []
Astory = []
Afree = []
for one in article:
if one.Class == "card":
Acard.append(one)
if one.Class == "story":
Astory.append(one)
if one.Class == "free":
Afree.append(one)
if len(Acard) > 10:
Acard=Acard[:10]
if len(Afree)>10:
Afree=Afree[:10]
if len(Astory)>10:
Astory=Astory[:10]
self.render("user.html",U=U,F=F,user=user,Acard=Acard,Astory=Astory,Afree=Afree,Vuser=Vuser)
else:
self.redirect("/")