本文整理汇总了Python中corehq.apps.sms.models.PhoneNumber.domain方法的典型用法代码示例。如果您正苦于以下问题:Python PhoneNumber.domain方法的具体用法?Python PhoneNumber.domain怎么用?Python PhoneNumber.domain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.sms.models.PhoneNumber
的用法示例。
在下文中一共展示了PhoneNumber.domain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save_verified_number
# 需要导入模块: from corehq.apps.sms.models import PhoneNumber [as 别名]
# 或者: from corehq.apps.sms.models.PhoneNumber import domain [as 别名]
def save_verified_number(self, domain, phone_number, verified, backend_id=None, ivr_backend_id=None, only_one_number_allowed=False):
"""
Saves the given phone number as this contact's verified phone number.
backend_id - the name of an SMSBackend to use when sending SMS to
this number; if specified, this will override any project or
global settings for which backend will be used to send sms to
this number
return The PhoneNumber
raises InvalidFormatException if the phone number format is invalid
raises PhoneNumberInUseException if the phone number is already in use by another contact
"""
from corehq.apps.sms.models import PhoneNumber
phone_number = apply_leniency(phone_number)
self.verify_unique_number(phone_number)
if only_one_number_allowed:
v = self.get_verified_number()
else:
v = self.get_verified_number(phone_number)
if v is None:
v = PhoneNumber(
owner_doc_type=self.doc_type,
owner_id=self.get_id
)
v.domain = domain
v.phone_number = phone_number
v.verified = verified
v.backend_id = backend_id
v.ivr_backend_id = ivr_backend_id
v.save()