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


Python models.Repeater類代碼示例

本文整理匯總了Python中corehq.apps.receiverwrapper.models.Repeater的典型用法代碼示例。如果您正苦於以下問題:Python Repeater類的具體用法?Python Repeater怎麽用?Python Repeater使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Repeater類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: obj_update

 def obj_update(self, bundle, **kwargs):
     bundle.obj = Repeater.get(kwargs['pk'])
     assert bundle.obj.domain == kwargs['domain']
     bundle = self._update(bundle)
     assert bundle.obj.domain == kwargs['domain']
     bundle.obj.save()
     return bundle
開發者ID:ekush,項目名稱:commcare-hq,代碼行數:7,代碼來源:v0_4.py

示例2: quick_find

def quick_find(request):
    query = request.GET.get('q')
    redirect = request.GET.get('redirect') != 'false'
    if not query:
        return HttpResponseBadRequest('GET param "q" must be provided')

    def deal_with_couch_doc(doc):
        domain = doc.get('domain') or doc.get('domains', [None])[0]
        if request.couch_user.is_superuser or (domain and request.couch_user.is_domain_admin(domain)):
            doc_info = get_doc_info(doc, domain_hint=domain)
        else:
            raise Http404()
        if redirect and doc_info.link:
            messages.info(request, _("We've redirected you to the %s matching your query") % doc_info.type_display)
            return HttpResponseRedirect(doc_info.link)
        else:
            return json_response(doc_info)

    try:
        doc = get_db().get(query)
    except ResourceNotFound:
        pass
    else:
        return deal_with_couch_doc(doc)

    try:
        doc = Repeater.get_db().get(query)
    except ResourceNotFound:
        pass
    else:
        return deal_with_couch_doc(doc)

    raise Http404()
開發者ID:SEL-Columbia,項目名稱:commcare-hq,代碼行數:33,代碼來源:views.py

示例3: obj_get_list

 def obj_get_list(self, bundle, domain, **kwargs):
     repeaters = Repeater.by_domain(domain)
     return list(repeaters)
開發者ID:ekush,項目名稱:commcare-hq,代碼行數:3,代碼來源:v0_4.py


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