当前位置: 首页>>代码示例>>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;未经允许,请勿转载。