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


Python User.select方法代码示例

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


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

示例1: post

# 需要导入模块: from db.models import User [as 别名]
# 或者: from db.models.User import select [as 别名]
 def post(self):
     if not self.request.headers.get("Cookie"):
         self.render("require_enable_cookie.html")
         return
     name = self.get_argument("name", '')
     password = self.get_argument("password", '')
     password = hashlib.md5(password).hexdigest()
     email = self.get_argument("email", '')
     domain = self.get_argument("domain", '')
     if domain == '':
         domain = name
     if User.select().where(user_email=email).count():
         self.write('用户已经存在,请直接登录')
         self.redirect("/login")
     else:
         u = User.create(user_name=name,
                         user_pass=password,
                         user_email=email,
                         user_domain=domain, )
         user = {'user_id': u.id,
                 'user_name': u.user_name,
                 'user_email': u.user_email,
                 'user_domain': u.user_domain}
         self.set_secure_cookie("user", tornado.escape.json_encode(user))
         self.redirect(self.get_argument("next", "/"))
开发者ID:excelgco,项目名称:anwen.in,代码行数:27,代码来源:user.py

示例2: get

# 需要导入模块: from db.models import User [as 别名]
# 或者: from db.models.User import select [as 别名]
 def get(self, node):
     page = self.get_argument("page", "1")
     realpage = int(page)
     shares = Share.select().where(
         sharetype=node).order_by('id').paginate(realpage, 10)
     sharesum = shares.count()
     pagesum = (sharesum + 9) / 10
     for share in shares:
         user = User.get(id=share.user_id)
         share.name = user.user_name
         share.domain = user.user_domain
         share.markdown = filter_tags(share.markdown)[:100]
         share.gravatar = get_avatar(user.user_email, 16)
     members = User.select().order_by('id').paginate(1, 20)
     for member in members:
         user = User.get(id=member.id)
         member.gravatar = get_avatar(user.user_email, 35)
     self.render(
         "node.html", shares=shares, members=members,
         pagesum=pagesum, page=page, node=node)
开发者ID:xiaocao,项目名称:anwen.in,代码行数:22,代码来源:index.py

示例3: get

# 需要导入模块: from db.models import User [as 别名]
# 或者: from db.models.User import select [as 别名]
 def get(self):
     page = self.get_argument("page", "1")
     realpage = int(page)
     shares = Share.select().order_by(('id', 'desc')).paginate(realpage, 10)
     sharesum = shares.count()
     pagesum = (sharesum + 9) / 10
     for share in shares:
         user = User.get(id=share.user_id)
         share.name = user.user_name
         share.domain = user.user_domain
         share.markdown = filter_tags(
             markdown.markdown(share.markdown))[:100]
         share.gravatar = get_avatar(user.user_email, 16)
     members = User.select().order_by(('id', 'desc')).paginate(1, 20)
     for member in members:
         user = User.get(id=member.id)
         member.gravatar = get_avatar(user.user_email, 25)
     Share.select().order_by(
         ('status', 'desc'), ('id', 'desc')).limit(5)
     node = 'home'
     node_about = options.node_about[node]
     self.render(
         "node.html", shares=shares, members=members,
         pagesum=pagesum, page=page, node=node, node_about=node_about)
开发者ID:excelgco,项目名称:anwen.in,代码行数:26,代码来源:index.py

示例4: get

# 需要导入模块: from db.models import User [as 别名]
# 或者: from db.models.User import select [as 别名]
 def get(self):
     members = User.select()
     self.render("member.html", members = members)
开发者ID:xiaocao,项目名称:anwen.in,代码行数:5,代码来源:user.py


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