Exemplo n.º 1
0
 def result_headers(self):
     """
     返回列表的列头信息. 返回一个 :class:`ResultRow` 实例, 其 ``cells`` 属性包含列信息
     """
     row = ResultRow()
     row['num_sorted_fields'] = 0
     row.cells = [self.result_header(
         field_name, row) for field_name in self.list_display]
     return row
Exemplo n.º 2
0
    def result_row(self, obj):
        """
        返回列表某一行的内容信息. 返回一个 :class:`ResultRow` 实例, 其 ``cells`` 属性包含各列内容信息

        :param obj: Model 对象
        """
        row = ResultRow()
        row['is_display_first'] = True
        row['object'] = obj
        row.cells = [self.result_item(
            obj, field_name, row) for field_name in self.list_display]
        return row