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


Python Post.count方法代码示例

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


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

示例1: test_delete

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import count [as 别名]
 def test_delete(self):
     assert self.models.where(
         User.id == Post.user_id).delete().execute() == 8
     assert self.models.where(
         User.id == Post.user_id).select().execute().count == 0
     assert Post.count() == 0
     assert User.count() == 0
开发者ID:zhangjinglei,项目名称:skylark,代码行数:9,代码来源:tests.py

示例2: adminpostlist

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import count [as 别名]
def adminpostlist():
    perpage = g.config["ADMIN_ITEM_COUNT"]
    args = request.args

    page = int(args.get("page", 1))

    kargs = {}
    if "is_original" in args and args["is_original"] == "true":
        kargs["is_original"] = True
    elif "is_original" in args and args["is_original"] == "false":
        kargs["is_original"] = False

    if "allow_visit" in args and args["allow_visit"] == "true":
        kargs["allow_visit"] = True
    elif "allow_visit" in args and args["allow_visit"] == "false":
        kargs["allow_visit"] = False

    if "allow_comment" in args and args["allow_comment"] == "true":
        kargs["allow_comment"] = True
    elif "allow_comment" in args and args["allow_comment"] == "false":
        kargs["allow_comment"] = False

    postlist = Post.get_page(offset=(page-1)*perpage, limit=perpage, **kargs)

    pager = gen_pager(page, Post.count(**kargs), perpage, request.url)
    return render_template('admin/postlist.html',
                           postlist=postlist,
                           admin_url="pagelist",
                           pager=pager,
                           parameter=request.query_string)
开发者ID:minyoad,项目名称:Tyou,代码行数:32,代码来源:admin.py

示例3: test_delete

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import count [as 别名]
 def test_delete(self):
     if db_type != 'sqlite':  # sqlite dosen't support 'delete xx from xxx'
         assert self.models.where(
             User.id == Post.user_id).delete().execute() == 8
         assert self.models.where(
             User.id == Post.user_id).select().execute().count == 0
         assert Post.count() == 0
         assert User.count() == 0
开发者ID:bopo,项目名称:skylark,代码行数:10,代码来源:tests.py

示例4: test_count

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import count [as 别名]
 def test_count(self):
     self.create_data(4)
     assert User.count() == 4
     assert Post.count() == 4
     query = User.select(fn.count(User.id))
     result = query.execute()
     assert result.count == 1
     assert result.tuples()[0][0] == 4
开发者ID:bopo,项目名称:skylark,代码行数:10,代码来源:tests.py

示例5: count_posts

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import count [as 别名]
def count_posts():
    return Post.count()
开发者ID:IuryAlves,项目名称:pygame-site,代码行数:4,代码来源:usecase.py


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