jieter/django-tables2

Default value not respected on export

Open

#710 aperta il 30 ott 2019

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Python (417 fork)batch import
Help wanteddocs

Metriche repository

Star
 (1693 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor