当前位置: 首页>>代码示例>>Python>>正文


Python CommCareCaseGroup.save方法代码示例

本文整理汇总了Python中corehq.apps.casegroups.models.CommCareCaseGroup.save方法的典型用法代码示例。如果您正苦于以下问题:Python CommCareCaseGroup.save方法的具体用法?Python CommCareCaseGroup.save怎么用?Python CommCareCaseGroup.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在corehq.apps.casegroups.models.CommCareCaseGroup的用法示例。


在下文中一共展示了CommCareCaseGroup.save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_group

# 需要导入模块: from corehq.apps.casegroups.models import CommCareCaseGroup [as 别名]
# 或者: from corehq.apps.casegroups.models.CommCareCaseGroup import save [as 别名]
 def create_group(self, domain):
     group = CommCareCaseGroup(
         name=self.cleaned_data['name'],
         domain=domain
     )
     group.save()
     return group
开发者ID:johan--,项目名称:commcare-hq,代码行数:9,代码来源:forms.py

示例2: test_case_group_recipient_with_user_data_filter

# 需要导入模块: from corehq.apps.casegroups.models import CommCareCaseGroup [as 别名]
# 或者: from corehq.apps.casegroups.models.CommCareCaseGroup import save [as 别名]
    def test_case_group_recipient_with_user_data_filter(self):
        # The user data filter should have no effect here because all
        # the recipients are cases.

        schedule = TimedSchedule.create_simple_daily_schedule(
            self.domain,
            TimedEvent(time=time(9, 0)),
            SMSContent(message={'en': 'Hello'})
        )
        schedule.user_data_filter = {'role': ['nurse']}
        schedule.save()

        with create_case(self.domain, 'person') as case:
            case_group = CommCareCaseGroup(domain=self.domain, cases=[case.case_id])
            case_group.save()
            self.addCleanup(case_group.delete)

            instance = CaseTimedScheduleInstance(
                domain=self.domain,
                timed_schedule_id=schedule.schedule_id,
                recipient_type=ScheduleInstance.RECIPIENT_TYPE_CASE_GROUP,
                recipient_id=case_group.get_id,
            )
            recipients = list(instance.expand_recipients())
            self.assertEqual(len(recipients), 1)
            self.assertEqual(recipients[0].case_id, case.case_id)
开发者ID:dimagi,项目名称:commcare-hq,代码行数:28,代码来源:test_recipients.py


注:本文中的corehq.apps.casegroups.models.CommCareCaseGroup.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。