本文整理匯總了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)