you can use resources.ModelResource from import_export packages.

example: Book have author field, a foreign key from Author model.

in admin.py you can add BookResource

class BookResource(resources.ModelResource):

class Meta:

model = Book

fields = ('title', 'description', 'author__name', 'year')

and need to add resource_class in BookAdmin

class BookAdmin(ExportActionMixin, admin.ModelAdmin):

resource_class = BookResource

list_display = ('title', 'description', 'author', 'year')

hope this help

--

--

Software Engineer, Indonesia

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store