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


Python StaticReportConfiguration.by_id方法代码示例

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


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

示例1: copy_ucr_reports

# 需要导入模块: from corehq.apps.userreports.models import StaticReportConfiguration [as 别名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import by_id [as 别名]
    def copy_ucr_reports(self, datasource_map):
        report_map = {}
        reports = get_report_configs_for_domain(self.existing_domain)
        for report in reports:
            old_datasource_id = report.config_id
            try:
                report.config_id = datasource_map[old_datasource_id]
            except KeyError:
                pass  # datasource not found

            old_id, new_id = self.save_couch_copy(report, self.new_domain)
            report_map[old_id] = new_id
        for static_report in StaticReportConfiguration.by_domain(self.existing_domain):
            if static_report.get_id.startswith(STATIC_PREFIX):
                report_id = static_report.get_id.replace(
                    STATIC_PREFIX + self.existing_domain + '-',
                    ''
                )
                is_custom_report = False
            else:
                report_id = static_report.get_id.replace(
                    CUSTOM_REPORT_PREFIX + self.existing_domain + '-',
                    ''
                )
                is_custom_report = True
            new_id = StaticReportConfiguration.get_doc_id(
                self.new_domain, report_id, is_custom_report
            )
            # check that new report is in new domain's list of static reports
            StaticReportConfiguration.by_id(new_id)
            report_map[static_report.get_id] = new_id
        return report_map
开发者ID:saketkanth,项目名称:commcare-hq,代码行数:34,代码来源:clone_domain.py

示例2: get_static_report_mapping

# 需要导入模块: from corehq.apps.userreports.models import StaticReportConfiguration [as 别名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import by_id [as 别名]
def get_static_report_mapping(from_domain, to_domain):
    from corehq.apps.userreports.models import StaticReportConfiguration, STATIC_PREFIX, \
        CUSTOM_REPORT_PREFIX

    report_map = {}

    for static_report in StaticReportConfiguration.by_domain(from_domain):
        if static_report.get_id.startswith(STATIC_PREFIX):
            report_id = static_report.get_id.replace(
                STATIC_PREFIX + from_domain + '-',
                ''
            )
            is_custom_report = False
        else:
            report_id = static_report.get_id.replace(
                CUSTOM_REPORT_PREFIX + from_domain + '-',
                ''
            )
            is_custom_report = True
        new_id = StaticReportConfiguration.get_doc_id(
            to_domain, report_id, is_custom_report
        )
        # check that new report is in new domain's list of static reports
        try:
            StaticReportConfiguration.by_id(new_id, to_domain)
        except (BadSpecError, DocumentNotFound):
            pass
        else:
            report_map[static_report.get_id] = new_id
    return report_map
开发者ID:kkrampa,项目名称:commcare-hq,代码行数:32,代码来源:util.py

示例3: _get_static_report_configuration_without_owner_transform

# 需要导入模块: from corehq.apps.userreports.models import StaticReportConfiguration [as 别名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import by_id [as 别名]
 def _get_static_report_configuration_without_owner_transform(self, report_id, domain):
     static_report_configuration = StaticReportConfiguration.by_id(report_id, domain)
     for report_column in static_report_configuration.report_columns:
         transform = report_column.transform
         if transform.get('type') == 'custom' and transform.get('custom_type') == 'owner_display':
             report_column.transform = {}
     return static_report_configuration
开发者ID:kkrampa,项目名称:commcare-hq,代码行数:9,代码来源:__init__.py

示例4: _get_report_configuration

# 需要导入模块: from corehq.apps.userreports.models import StaticReportConfiguration [as 别名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import by_id [as 别名]
 def _get_report_configuration(self, id_, domain):
     """
     Fetch the required ReportConfiguration object
     :param id_: The id of the ReportConfiguration
     :param domain: The domain of the ReportConfiguration
     :return: A ReportConfiguration
     """
     try:
         if report_config_id_is_static(id_):
             return StaticReportConfiguration.by_id(id_, domain=domain)
         else:
             return get_document_or_not_found(ReportConfiguration, domain, id_)
     except DocumentNotFound:
         raise NotFound
开发者ID:kkrampa,项目名称:commcare-hq,代码行数:16,代码来源:v0_5.py

示例5: spec

# 需要导入模块: from corehq.apps.userreports.models import StaticReportConfiguration [as 别名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import by_id [as 别名]
 def spec(self):
     if self.is_static:
         return StaticReportConfiguration.by_id(self.report_config_id, domain=self.domain)
     else:
         return get_document_or_not_found(ReportConfiguration, self.domain, self.report_config_id)
开发者ID:kkrampa,项目名称:commcare-hq,代码行数:7,代码来源:view.py


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