Export Excel from Django with verbose names

Viewed 25

I am using DjangoObjectActions from django_object_actions package that adds an action in Django Admin to export my Querys model to excel.

class QueryAdmin(DjangoObjectActions, admin.ModelAdmin):
    def export_to_xls(self, request, obj):
        query_record = Query.objects.all().values('profile__full_name')
        return excel.make_response_from_records(
            query_record,
            'xlsx',
            file_name="Querys"
        )

    list_display = ('weight', 'height')
    export_to_xls.label = "Export to Excel"
    changelist_actions = ('export_to_xls',)

I could not find how to export my table with columns' verbose names. I found how to just get the verbose names of columns but is there a way to export them to excel?

I need it because verbose names are in different language and that would be really great to show columns titles like that.

Would be grateful for any help!

0 Answers
Related