(self, table, exclude_columns, dataset_kwargs=None)
return dataset
Transform a table to a tablib dataset.
Transform a table to a tablib dataset.
Transform a table to a tablib dataset .
def table_to_dataset(self, table, exclude_columns, dataset_kwargs=None):
        """Transform a table to a tablib dataset."""

        def default_dataset_title():
            try:
                return table.Meta.model._meta.verbose_name_plural.title()
            except AttributeError:
                return "Export Data"

        kwargs = {"title": default_dataset_title()}
        kwargs.update(dataset_kwargs or {})
        dataset = Dataset(**kwargs)
        for i, row in enumerate(table.as_values(exclude_columns=exclude_columns)):
            if i == 0:
                dataset.headers = row
            else:
                dataset.append(row)
        return dataset
def table_to_dataset ( self , table , exclude_columns , dataset_kwargs = None ) : def default_dataset_title ( ) : try : return table . Meta . model . _meta . verbose_name_plural . title ( ) except AttributeError : return "Export Data" kwargs = { "title" : default_dataset_title ( ) } kwargs . update ( dataset_kwargs or { } ) dataset = Dataset ( * * kwargs ) for i , row in enumerate ( table . as_values ( exclude_columns = exclude_columns ) ) : if i == 0 : dataset . headers = row else : dataset . append ( row ) return dataset