jieter/django-tables2

Default value not respected on export

開放

#710 建立於 2019年10月30日

 (1 則留言) (0 個反應) (0 位負責人)Python (443 個分叉)batch import
Help wanteddocs

倉庫指標

星標
 (2,012 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

I use the default value heavily in my tables, but noticed that default is not respected when I export tables.

It's the following code in django_tables2/rows.py

    def get_cell_value(self, name):
        """
        Returns the final rendered value (excluding any html) for a cell in the
        row, given the name of a column.
        """
        return self._get_and_render_with(
            self.table.columns[name], render_func=self._call_value, default=None
        )

As you can see, default=None is passed to get_and_render_with, effectively ignoring the default value.

Is there a reason for this? If there is, should we document it? Happy to contribute.

Thanks for the great library.

貢獻者指南