當前位置: 首頁>>代碼示例>>Python>>正文


Python Po.where方法代碼示例

本文整理匯總了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()
開發者ID:,項目名稱:,代碼行數:9,代碼來源:

示例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)
開發者ID:,項目名稱:,代碼行數:11,代碼來源:

示例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()
開發者ID:,項目名稱:,代碼行數:8,代碼來源:

示例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

開發者ID:,項目名稱:,代碼行數:31,代碼來源:

示例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()
開發者ID:,項目名稱:,代碼行數:5,代碼來源:

示例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)
開發者ID:,項目名稱:,代碼行數:6,代碼來源:

示例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
開發者ID:,項目名稱:,代碼行數:6,代碼來源:

示例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):
開發者ID:,項目名稱:,代碼行數:32,代碼來源:

示例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')
開發者ID:,項目名稱:,代碼行數:4,代碼來源:

示例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()
開發者ID:,項目名稱:,代碼行數:8,代碼來源:


注:本文中的po.Po.where方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。