本文整理汇总了Python中torlite.model.core_tab.CabPost.select方法的典型用法代码示例。如果您正苦于以下问题:Python CabPost.select方法的具体用法?Python CabPost.select怎么用?Python CabPost.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类torlite.model.core_tab.CabPost
的用法示例。
在下文中一共展示了CabPost.select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: query_cat_random
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def query_cat_random(self, cat_id, num=6):
if cat_id == '':
return self.query_random(num)
if config.dbtype == 1 or config.dbtype == 3:
return CabPost.select().join(CabPost2Catalog).where(CabPost2Catalog.catalog == cat_id).order_by(
peewee.fn.Random()).limit(num)
elif config.dbtype == 2:
return CabPost.select().join(CabPost2Catalog).where(CabPost2Catalog.catalog == cat_id).order_by(
peewee.fn.Rand()).limit(num)
示例2: get_previous_record
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def get_previous_record(self, in_uid):
current_rec = self.get_by_id(in_uid)
query = CabPost.select().where(CabPost.time_update > current_rec.time_update).order_by(CabPost.time_update)
if query.count() == 0:
return None
else:
return query.get()
示例3: get_by_wiki
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def get_by_wiki(self, citiao):
tt = CabPost.select().where(CabPost.title == citiao).count()
if tt == 0:
return None
else:
self.update_view_count(citiao)
return CabPost.get(CabPost.title == citiao)
示例4: query_most
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def query_most(self, num=8):
return CabPost.select().order_by(CabPost.view_count.desc()).limit(num)
示例5: query_cat_recent
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def query_cat_recent(self, cat_id, num=8):
return CabPost.select().join(CabPost2Catalog).where(CabPost2Catalog.catalog == cat_id).order_by(
CabPost.time_update.desc()).limit(num)
示例6: query_most_pic
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def query_most_pic(self, num):
return CabPost.select().where( CabPost.logo != "").order_by(CabPost.view_count.desc()).limit(num)
示例7: query_dated
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def query_dated(self, num=8):
return CabPost.select().order_by(CabPost.time_update.asc()).limit(num)
示例8: query_by_spec
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def query_by_spec(self, spec_id):
return CabPost.select().where(CabPost.id_spec == spec_id).order_by(CabPost.time_update.desc())
示例9: query_all
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def query_all(self):
return CabPost.select()
示例10: query_pager_by_slug
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def query_pager_by_slug(self, slug, current_page_num=1):
return CabPost.select().join(CabPost2Catalog).join(CabCatalog).where(CabCatalog.slug == slug).order_by(
CabPost.time_update.desc()).paginate(current_page_num, config.page_num)
示例11: query_random
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def query_random(self, num=6):
if config.dbtype == 1 or config.dbtype == 3:
return CabPost.select().order_by(peewee.fn.Random()).limit(num)
elif config.dbtype == 2:
return CabPost.select().order_by(peewee.fn.Rand()).limit(num)
示例12: query_old
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def query_old(self):
return CabPost.select().order_by('time_update').limit(10)
示例13: get_by_keyword
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def get_by_keyword(self, par2):
return CabPost.select().where(CabPost.title.contains(par2)).order_by(CabPost.time_update.desc()).limit(20)
示例14: query_recent_most
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def query_recent_most(self, num=8, recent=30):
time_that = int(time.time()) - recent * 24 * 3600
return CabPost.select().where(CabPost.time_update > time_that).order_by(CabPost.view_count.desc()).limit(num)
示例15: query_recent
# 需要导入模块: from torlite.model.core_tab import CabPost [as 别名]
# 或者: from torlite.model.core_tab.CabPost import select [as 别名]
def query_recent(self, num=8):
return CabPost.select().order_by(CabPost.time_update.desc()).limit(num)