当前位置: 首页>>代码示例>>Python>>正文


Python User.get_user_by_name方法代码示例

本文整理汇总了Python中models.user.User.get_user_by_name方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_user_by_name方法的具体用法?Python User.get_user_by_name怎么用?Python User.get_user_by_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.user.User的用法示例。


在下文中一共展示了User.get_user_by_name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [as 别名]
 def post(self):
     uname = self.get_current_user()
     user = User.get_user_by_name(uname)
     if len(user)>0:
         aid = self.get_argument("aid",None)
         uid = user[0].uid
         touname = self.get_argument("touname",None)
         touid = User.get_user_by_name(touname)[0].uid
         comment = self.get_argument("comment")
         date = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())
         Comment.add_one_comment(aid,uid,touid,comment,date)
         Article.add_one_ncomment(aid)
         self.redirect("/article?aid="+str(aid)+"#comment-id")
     else:
         self.redirect("/login")
开发者ID:oujiaqi,项目名称:suiyue,代码行数:17,代码来源:article.py

示例2: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [as 别名]
 def get(self):
     uname = self.get_current_user()
     user = User.get_user_by_name(uname)
     order = get_order()
     story = Story.get_by_porder(order)
     sid = self.get_argument("sid",None)
     if sid is not None:
         story=Story.get_by_sid(sid)
     article = Article.get_all_Astory(200)
     usedStory = Story.get_all_story()
     temp = []
     for one in usedStory:
         if one.porder > 0 and one.porder <= order:
             temp.append(one)
     usedStory = temp
     reArticles = Article.get_all(200)
     Rarticle = sorted(reArticles,BaseHandler.rank)
     Ruser = User.get_all_user(100)
     if len(Rarticle) > 6:
         Rarticle=Rarticle[:6]
     if len(usedStory)>3:
         usedStory=usedStory[:3]
     if len(Ruser)>9:
         Ruser=Ruser[:9]
     self.render("story.html",user=user,Rarticle=Rarticle,Article=article,usedStory=usedStory,Ruser=Ruser,story=story)
开发者ID:oujiaqi,项目名称:suiyue,代码行数:27,代码来源:story.py

示例3: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [as 别名]
 def get(self):
     uname = self.get_current_user()
     user = User.get_user_by_name(uname)
     order = get_order()
     card = Card.get_by_porder(order)
     cid = self.get_argument("cid",None)
     if cid is not None:
         card=Card.get_by_cid(cid)
     article = Article.get_all_Acard(200)
     usedCard = Card.get_all_card()
     temp = []
     for one in usedCard:
         if 0 < one.porder and one.porder <= order:
             temp.append(one)
     usedCard = temp
     reArticles = Article.get_all(200)
     Rarticle = sorted(reArticles,BaseHandler.rank)
     if len(Rarticle) > 6:
         Rarticle = Rarticle[:6]
     Ruser = User.get_all_user(100)
     if len(Ruser)>9:
         Ruser = Ruser[:9]
     if len(usedCard)>3:
         usedCard = usedCard[:3]
     self.render("card.html",user=user,Rarticle=Rarticle,Article=article,usedCard=usedCard,Ruser=Ruser,card=card)
开发者ID:oujiaqi,项目名称:suiyue,代码行数:27,代码来源:card.py

示例4: post

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [as 别名]
 def post(self):
     uname = self.get_current_user()
     user = User.get_user_by_name(uname)
     main = self.get_argument("main")
     pic = "default.jpg"
     Card.add_one_card(pic,user[0].uid,main)
     self.render("wcard.html", msg="投稿成功,谢谢你的idea",user=user)
开发者ID:oujiaqi,项目名称:suiyue,代码行数:9,代码来源:card.py

示例5: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [as 别名]
 def get(self):
     uname = self.get_current_user()
     user = User.get_user_by_name(uname)
     error=""
     if len(user) > 0:
         self.render("change.html",user=user,error=error)
     else:
         self.redirect("/login")
开发者ID:oujiaqi,项目名称:suiyue,代码行数:10,代码来源:setting.py

示例6: post

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [as 别名]
    def post(self):
        uname = self.get_current_user()
        user = User.get_user_by_name(uname)
        title = self.get_argument("title")
        content = self.get_argument("content")
        pic = "default.jpg"
        Story.add_one_story(pic,user[0].uid,title,content)
        self.render("wstory.html", msg="投稿成功,谢谢你的idea",user=user)

        
开发者ID:oujiaqi,项目名称:suiyue,代码行数:10,代码来源:story.py

示例7: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [as 别名]
 def get(self):
     uname = self.get_current_user()
     user = User.get_user_by_name(uname)
     article = Article.get_all_Afree(200)
     reArticles = Article.get_all(200)
     Rarticle = sorted(reArticles,BaseHandler.rank)
     if len(Rarticle) > 6:
         Rarticle = Rarticle[:6]
     Ruser = User.get_all_user(100)
     if len(Ruser)>9:
         Ruser = Ruser[:9]
     self.render("free.html",user=user,Rarticle=Rarticle,Article=article,Ruser=Ruser)
开发者ID:oujiaqi,项目名称:suiyue,代码行数:14,代码来源:free.py

示例8: post

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [as 别名]
 def post(self):
     uname = self.get_current_user()
     user = User.get_user_by_name(uname)
     if len(user)>0:
         fid = user[0].uid
         bfid = self.get_argument("bfid")
         focus = self.get_argument("focus")
         if focus=="stop":
             User.stop_focus_on_sb(fid,bfid)
             self.redirect("/user?uid="+str(bfid))
         if focus=="focus":
             User.focus_on_sb(fid,bfid)
             self.redirect("/user?uid="+str(bfid))
     else:
         redirect("/")
开发者ID:oujiaqi,项目名称:suiyue,代码行数:17,代码来源:user.py

示例9: post

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [as 别名]
 def post(self):
     uname = self.get_argument("name")
     email = self.get_argument("email")
     password = self.get_argument("password")
     npassword = self.get_argument("npassword")
     if password==npassword and not User.is_email_exist(email) and not User.is_uname_exist(uname):
         sdate = time.strftime("%Y-%m-%d",time.localtime())
         User.add_one_user(email,uname,password,sdate,'',"default.jpg","N")
         user = User.get_user_by_name(uname)
         self.set_secure_cookie("user",user[0].uname)
         self.set_secure_cookie("uid","user[0].uid")
         self.redirect("/")
     else:
         self.redirect("/signin")
         
开发者ID:oujiaqi,项目名称:suiyue,代码行数:16,代码来源:signin.py

示例10: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [as 别名]
 def get(self):
     uname=self.get_current_user()
     user=User.get_user_by_name(uname)
     if len(user) > 0:
         cid = self.get_argument("cid", None)
         sid = self.get_argument("sid", None)
         Class = "free"
         if cid is not None:
             Class="card"
         elif sid is not None:
             Class="story"
         card=Card.get_by_cid(cid)
         story=Story.get_by_sid(sid)
         self.render("write.html",user=user,card=card,story=story,Class=Class)
     else:
         self.redirect("/login")
开发者ID:oujiaqi,项目名称:suiyue,代码行数:18,代码来源:write.py

示例11: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [as 别名]
    def get(self):
        uname = self.get_current_user()
        user = User.get_user_by_name(uname)
        '''every recommendation'''
        reArticles = Article.get_all(200)
        Rarticle = sorted(reArticles,BaseHandler.rank)
        if len(Rarticle)>6:
            Rarticle=Rarticle[:6]
        '''get suiyue circle'''
        circle = Article.get_all(100)
        '''get suiyou'''
        Ruser = User.get_all_user(100)
        if len(Ruser)>9:
            Ruser=Ruser[:9]
        self.render("read.html",user=user,Rarticle=Rarticle,Circle=circle,Ruser=Ruser, Title="岁阅美文")

        
开发者ID:oujiaqi,项目名称:suiyue,代码行数:17,代码来源:read.py

示例12: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [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)
开发者ID:oujiaqi,项目名称:suiyue,代码行数:20,代码来源:article.py

示例13: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [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("/")
开发者ID:oujiaqi,项目名称:suiyue,代码行数:41,代码来源:user.py

示例14: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [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("/")
开发者ID:oujiaqi,项目名称:suiyue,代码行数:25,代码来源:fans.py

示例15: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_by_name [as 别名]
 def get(self):
     uname = self.get_current_user()
     user = User.get_user_by_name(uname)
     '''every recommendation'''
     reArticles = Article.get_all(200)
     Rarticle = sorted(reArticles,BaseHandler.rank)
     if len(Rarticle)>6:
         Rarticle=Rarticle[:6]
     '''best today'''
     date = time.strftime("%Y-%m-%d",time.localtime())
     beArticles = Article.get_by_date(date,200)
     Barticle = sorted(beArticles,BaseHandler.rank)
     '''get suiyue circle'''
     if len(user)>0:
         circle = Article.get_article_by_user_focus(user[0].uid, 25)
     else:
         circle = Article.get_all(200)
     if len(circle)>100:
         circle = circle[:100]
     '''get suiyou'''
     Ruser = User.get_all_user(100)
     if len(Ruser)>9:
         Ruser=Ruser[:9]
     self.render("index.html",user=user,Rarticle=Rarticle,Barticle=Barticle,Circle=circle,Ruser=Ruser)
开发者ID:oujiaqi,项目名称:suiyue,代码行数:26,代码来源:index.py


注:本文中的models.user.User.get_user_by_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。