tabular_export.admin module

Usage can be as simple as adding the generic actions to a ModelAdmin:

actions = (export_to_excel_action, export_to_csv_action)

These will take the QuerySet and provide a generic export action which is essentially what you’d from the values() method. The filename will be generated from the model name specified for that ModelAdmin.

The allow you to pass a custom file filename or list of fields which are passed through directly to flatten_queryset() and export_to_excel_response() / export_to_csv_response()

tabular_export.admin.ensure_filename(suffix)[source]

Decorator which automatically sets the filename going into the admin actions from the ModelAdmin.model‘s verbose_name_plural value unless a value was provided by the caller.

tabular_export.admin.export_to_csv_action(modeladmin, request, queryset, filename=None, *args, **kwargs)[source]

Django admin action which exports the selected records as a CSV download

tabular_export.admin.export_to_excel_action(modeladmin, request, queryset, filename=None, *args, **kwargs)[source]

Django admin action which exports selected records as an Excel XLSX download