def _items(self, record):
for field_name, _ in self.get_fields():
# Does the field_name refer to an aggregation column or is
# it an attribute of this instance?
try:
attr_field = getattr(self, field_name)
except AttributeError:
# The field is a record element
ret = record.get(field_name)
formatting_func = self.get_formatting().get(field_name)
if formatting_func is not None:
try:
ret = formatting_func(ret)
except (TypeError, ValueError):
pass
else:
# The view class has an attribute with this field_name
if callable(attr_field):
ret = attr_field(record)
if getattr(attr_field, 'allow_tags', False):
ret = mark_safe(ret)
yield ret
评论列表
文章目录