joshourisman / django-tablib

django-tablib is a helper library for Django that allows Django models to be used to generate tablib datasets with introspection of the fields on the models if no headers are provided. If headers are provided they can reference any attribute, fields, properties, or methods on the model.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow exporting change list verbatim

treyhunner opened this issue · comments

Example which does not work because values in "headers" are expected to be model fields:

class SomeModelAdmin(TablibAdmin):
    list_display = ['id', 'name']
    formats = ['xls', 'csv']
    headers = list_display

    def name(self, obj):
        return "{0} {1}".format(obj.first_name, obj.last_name)

The fields could be rendered similarly to the way the change list fields are rendered.