本文整理汇总了Python中po.Po.where方法的典型用法代码示例。如果您正苦于以下问题:Python Po.where方法的具体用法?Python Po.where怎么用?Python Po.where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类po.Po
的用法示例。
在下文中一共展示了Po.where方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _po_cid_count_by_zsite_id
# 需要导入模块: from po import Po [as 别名]
# 或者: from po.Po import where [as 别名]
def _po_cid_count_by_zsite_id(zsite_id, cid):
qs = Po.where(
zsite_id=zsite_id
).where('state>=%s'%STATE_PO_ZSITE_SHOW_THEN_REVIEW)
if cid:
qs = qs.where(cid=cid)
return qs.count()
示例2: po_id_list_by_zsite_id
# 需要导入模块: from po import Po [as 别名]
# 或者: from po.Po import where [as 别名]
def po_id_list_by_zsite_id(zsite_id, cid, limit, offset):
qs = Po.where(
zsite_id=zsite_id
).where('state>=%s'%STATE_PO_ZSITE_SHOW_THEN_REVIEW)
if cid:
qs = qs.where(cid=cid)
return qs.order_by('id desc').col_list(limit, offset)
示例3: po_review_id_list_active_by_zsite_id
# 需要导入模块: from po import Po [as 别名]
# 或者: from po.Po import where [as 别名]
def po_review_id_list_active_by_zsite_id(id):
qs = Po.where(
zsite_id=id,
cid=CID_REVIEW
).where('state=%s'%STATE_ACTIVE).order_by('id desc')
return qs.col_list()
示例4: po_review_list_active_by_zsite_id
# 需要导入模块: from po import Po [as 别名]
# 或者: from po.Po import where [as 别名]
def po_review_list_active_by_zsite_id(id):
return Po.mc_get_list(
po_review_id_list_active_by_zsite_id(id)
)
if __name__ == '__main__':
#po_review_show_id_list_new(1, 2)
#print po_review_show_id_list(1)
#name = "gw"
#po_review_new(zsite_id, user_id, name)
#print po_review_id_get(895, 893)
# user_id =893
# zsite_id = 895
# for i in po_review_list_active_by_zsite_id(zsite_id):
# print i.name
zsite_id = 895
# print po_review_count(zsite_id)
# print po_review_list_by_zsite_id(zsite_id, 0, 1111)
zsite_id = 10163143
user_id = 10002411
po_review_get(zsite_id, user_id)
for i in Po.where(
zsite_id=zsite_id
).where('state=%s'%STATE_ACTIVE).order_by('id desc'):
print i.user_id, i.state
示例5: po_show_rm
# 需要导入模块: from po import Po [as 别名]
# 或者: from po.Po import where [as 别名]
def po_show_rm(po_id):
feed_rt_rm(0, po_id)
Po.where(user_id=0, rid=po_id, cid=CID_REC, state=STATE_ACTIVE).delete()
示例6: rm_rec_po_by_po_id
# 需要导入模块: from po import Po [as 别名]
# 或者: from po.Po import where [as 别名]
def rm_rec_po_by_po_id(user_id,id):
''' DANGEROUS USE WITH CAUTION '''
for po in Po.where('cid = %s and rid=%s',CID_REC,id):
po_rm(po.user_id,po.id)
示例7: answer_id_get
# 需要导入模块: from po import Po [as 别名]
# 或者: from po.Po import where [as 别名]
def answer_id_get(user_id, question_id):
for i in Po.where(user_id=user_id, rid=question_id).where('cid in (%s,%s)'%(CID_WORD, CID_ANSWER)).where('state>%s', STATE_RM).col_list(1, 0):
return i
return 0
示例8: po_question_new
# 需要导入模块: from po import Po [as 别名]
# 或者: from po.Po import where [as 别名]
def po_question_new(user_id, name, txt, state, zsite_id):
if not name and not txt:
return
name = name or time_title()
if not is_same_post(user_id, name, txt, zsite_id):
m = po_new(CID_QUESTION, user_id, name, state, zsite_id=zsite_id)
if m:
txt_new(m.id, txt)
if state > STATE_SECRET:
m.feed_new()
return m
mc_answer_id_get = McCache('AnswerIdGet.%s')
answer_count = McNum(lambda id:Po.where(rid=id).where('state>%s', STATE_RM).count(), 'AnswerCount:%s')
@mc_answer_id_get('{user_id}_{question_id}')
def answer_id_get(user_id, question_id):
for i in Po.where(user_id=user_id, rid=question_id).where('cid in (%s,%s)'%(CID_WORD, CID_ANSWER)).where('state>%s', STATE_RM).col_list(1, 0):
return i
return 0
def answer_word2note(po):
rid = po.rid
if rid and po.cid == CID_WORD:
po_cid_set(po, CID_ANSWER)
answer_count.delete(rid)
def po_answer_new(user_id, question_id, name, txt, state):
示例9: product_id_list_by_com_id
# 需要导入模块: from po import Po [as 别名]
# 或者: from po.Po import where [as 别名]
def product_id_list_by_com_id(id):
return Po.where(zsite_id=id, cid=CID_PRODUCT, state=STATE_ACTIVE).col_list(col='id')
示例10: po_event_notice_id_list_by_event_id
# 需要导入模块: from po import Po [as 别名]
# 或者: from po.Po import where [as 别名]
def po_event_notice_id_list_by_event_id(event_id):
from state import STATE_ACTIVE
return Po.where(
cid=CID_EVENT_NOTICE,
rid=event_id
).where('state>=%s'%STATE_ACTIVE).order_by('id desc').col_list()