本文整理汇总了Python中torlite.model.core_tab.CabVoter2Reply.create方法的典型用法代码示例。如果您正苦于以下问题:Python CabVoter2Reply.create方法的具体用法?Python CabVoter2Reply.create怎么用?Python CabVoter2Reply.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类torlite.model.core_tab.CabVoter2Reply
的用法示例。
在下文中一共展示了CabVoter2Reply.create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: insert_data
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import create [as 别名]
def insert_data(self, user_id, reply_id):
record = CabVoter2Reply.select().where(
(CabVoter2Reply.reply_id == reply_id) & (CabVoter2Reply.voter_id == user_id))
if record.count() > 0:
return (False)
try:
CabVoter2Reply.create(
uid=tools.get_uuid(),
reply_id=reply_id,
voter_id=user_id,
timestamp=time.time(),
)
return CabVoter2Reply.select().where(CabVoter2Reply.reply_id == reply_id).count()
except:
return False
示例2: insert_data
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import create [as 别名]
def insert_data(self, user_id, reply_id):
record = CabVoter2Reply.select().where(
(CabVoter2Reply.reply_id == reply_id) & ( CabVoter2Reply.voter_id == user_id ))
if record.count() > 0:
pass
return (False)
else:
entry = CabVoter2Reply.create(
uid=tools.get_uuid(),
reply_id=reply_id,
voter_id=user_id,
timestamp=time.time(),
)
cur_count = CabVoter2Reply.select().where(CabVoter2Reply.reply_id == reply_id).count()
return cur_count