本文整理汇总了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
示例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
示例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
示例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
示例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)