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