本文整理汇总了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
示例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)