當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。