本文整理汇总了Python中model_report.utils.ReportValue.is_group_total方法的典型用法代码示例。如果您正苦于以下问题:Python ReportValue.is_group_total方法的具体用法?Python ReportValue.is_group_total怎么用?Python ReportValue.is_group_total使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model_report.utils.ReportValue
的用法示例。
在下文中一共展示了ReportValue.is_group_total方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compute_row_totals
# 需要导入模块: from model_report.utils import ReportValue [as 别名]
# 或者: from model_report.utils.ReportValue import is_group_total [as 别名]
def compute_row_totals(row_config,
row_values,
is_group_total=False,
is_report_total=False):
total_row = self.get_empty_row_asdict(self.get_fields(),
ReportValue(' '))
for k, v in total_row.items():
if k in row_config:
fun = row_config[k]
value = fun(row_values[k])
if k in self.get_m2m_field_names():
value = ReportValue([
value,
])
value = ReportValue(value)
value.is_value = False
value.is_group_total = is_group_total
value.is_report_total = is_report_total
if k in self.override_field_values:
value.to_value = self.override_field_values[k]
if k in self.override_field_formats:
value.format = self.override_field_formats[k]
value.is_m2m_value = (k in self.get_m2m_field_names())
total_row[k] = value
row = self.reorder_dictrow(total_row)
row = ReportRow(row)
row.is_total = True
return row
示例2: compute_row_totals
# 需要导入模块: from model_report.utils import ReportValue [as 别名]
# 或者: from model_report.utils.ReportValue import is_group_total [as 别名]
def compute_row_totals(self, row_config, row_values, is_group_total=False, is_report_total=False,
filter_related_fields={}):
used_fields = [field for field in self.used_fields() if field not in filter_related_fields]
total_row = self.get_empty_row_asdict(used_fields, ReportValue(' '))
for field in used_fields:
if field in row_config:
fun = row_config[field]
value = fun(row_values[field])
if field in self.get_m2m_field_names():
value = ReportValue([value, ])
value = ReportValue(value)
value.is_value = False
value.is_group_total = is_group_total
value.is_report_total = is_report_total
# TODO: method should do only one thing.
# Remove ovveride_field_values from this function.
if field in self.override_field_values:
value.to_value = self.override_field_values[field]
if field in self.override_field_formats:
value.format = self.override_field_formats[field]
value.is_m2m_value = (field in self.get_m2m_field_names())
total_row[field] = value
row = self.reorder_dictrow(total_row)
row = ReportRow(row)
row.is_total = True
return row
示例3: compute_row_totals
# 需要导入模块: from model_report.utils import ReportValue [as 别名]
# 或者: from model_report.utils.ReportValue import is_group_total [as 别名]
def compute_row_totals(row_config, row_values, is_group_total=False, is_report_total=False):
total_row = self.get_empty_row_asdict(self.get_fields(), ReportValue(' '))
for field_name in total_row.keys():
if field_name in row_config:
fun = row_config[field_name]
cell_value = fun(row_values[field_name])
if field_name in self.get_m2m_field_names():
cell_value = ReportValue([cell_value])
# cell_value = [cell_value]
cell_value = ReportValue(cell_value)
cell_value.is_value = False
cell_value.is_group_total = is_group_total
cell_value.is_report_total = is_report_total
if field_name in self.override_field_values:
cell_value.to_value = self.override_field_values[field_name]
if field_name in self.override_field_formats:
cell_value.format = self.override_field_formats[field_name]
cell_value.is_m2m_value = field_name in self.get_m2m_field_names()
total_row[field_name] = cell_value
totals_row = ReportRow(self.reorder_dictrow(total_row))
totals_row.is_total = True
return totals_row