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


Python SmsBillable.save方法代码示例

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


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

示例1: arbitrary_sms_billables_for_domain

# 需要导入模块: from corehq.apps.smsbillables.models import SmsBillable [as 别名]
# 或者: from corehq.apps.smsbillables.models.SmsBillable import save [as 别名]
def arbitrary_sms_billables_for_domain(domain, message_month_date, num_sms, direction=None, multipart_count=1):
    from corehq.apps.smsbillables.models import SmsBillable, SmsGatewayFee, SmsUsageFee

    direction = direction or random.choice(DIRECTIONS)

    gateway_fee = SmsGatewayFee.create_new('MACH', direction, Decimal(0.5))
    usage_fee = SmsUsageFee.create_new(direction, Decimal(0.25))

    _, last_day_message = calendar.monthrange(message_month_date.year, message_month_date.month)

    billables = []
    for _ in range(0, num_sms):
        sms_billable = SmsBillable(
            gateway_fee=gateway_fee,
            usage_fee=usage_fee,
            log_id=data_gen.arbitrary_unique_name()[:50],
            phone_number=data_gen.random_phonenumber(),
            domain=domain,
            direction=direction,
            date_sent=datetime.date(message_month_date.year, message_month_date.month,
                                    random.randint(1, last_day_message)),
            multipart_count=multipart_count,
        )
        sms_billable.save()
        billables.append(sms_billable)
    return billables
开发者ID:saketkanth,项目名称:commcare-hq,代码行数:28,代码来源:generator.py

示例2: _get_updated_billable

# 需要导入模块: from corehq.apps.smsbillables.models import SmsBillable [as 别名]
# 或者: from corehq.apps.smsbillables.models.SmsBillable import save [as 别名]
 def _get_updated_billable(self, old_billable, updated_currency):
     new_billable = SmsBillable(
         log_id=old_billable.log_id,
         phone_number=old_billable.phone_number,
         direction=old_billable.direction,
         date_sent=old_billable.date_sent,
         domain=old_billable.domain,
         multipart_count=old_billable.multipart_count
     )
     new_billable.gateway_fee = old_billable.gateway_fee
     new_billable.gateway_fee_conversion_rate = updated_currency.rate_to_default
     new_billable.usage_fee = old_billable.usage_fee
     new_billable.save()
     return new_billable
开发者ID:saketkanth,项目名称:commcare-hq,代码行数:16,代码来源:retrobill_india_unicel_03012016.py

示例3: arbitrary_sms_billables_for_domain

# 需要导入模块: from corehq.apps.smsbillables.models import SmsBillable [as 别名]
# 或者: from corehq.apps.smsbillables.models.SmsBillable import save [as 别名]
def arbitrary_sms_billables_for_domain(domain, direction, message_month_date, num_sms):
    from corehq.apps.smsbillables.models import SmsBillable, SmsGatewayFee, SmsUsageFee
    from corehq.apps.smsbillables import generator as sms_gen

    gateway_fee = SmsGatewayFee.create_new('MACH', direction, sms_gen.arbitrary_fee())
    usage_fee = SmsUsageFee.create_new(direction, sms_gen.arbitrary_fee())

    _, last_day_message = calendar.monthrange(message_month_date.year, message_month_date.month)

    for _ in range(0, num_sms):
        sms_billable = SmsBillable(
            gateway_fee=gateway_fee,
            usage_fee=usage_fee,
            log_id=data_gen.arbitrary_unique_name()[:50],
            phone_number=data_gen.random_phonenumber(),
            domain=domain,
            direction=direction,
            date_sent=datetime.date(message_month_date.year, message_month_date.month,
                                    random.randint(1, last_day_message)),
        )
        sms_billable.save()
开发者ID:amonkeykong81,项目名称:commcare-hq,代码行数:23,代码来源:generator.py


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