I'm trying to enable the "Export selected" button in the Django admin for users to download data as an Excel sheet. I'm using django-import-export but the button isn't appearing.
Here's what I've done: Installed django-import-export (pip install django-import-export).
Trial 1:
class UserAdmin(ImportExportModelAdmin):
list_display = ('username', 'email'....)
admin.site.unregister(User)
admin.site.register(User, ImportExportModelAdmin)
Trial 2:
class UserAdmin(ExportMixin, admin.ModelAdmin):
list_display = ('username', 'email'.....)
admin.site.unregister(User)
admin.site.register(User, UserAdmin)
Restarted the development server.
the django-import-export is in INSTALLED_APPS in settings.py
Expected behavior: The "Export selected" button should appear in the Django admin user list view.
Actual behavior: The button is not displayed.
My Question: Why the button is not showing and how can I fix it.
Any suggestions or insights into why the button might not be showing would be greatly appreciated.
Here is how I enabled using the example app.
Go to the 'Category' model instance and add some new categories.
You can now select and export:
To enable this, simply subclass ExportActionModelAdmin
(refer to example code):
class CategoryAdmin(ExportActionModelAdmin):
pass
admin.site.register(Category, CategoryAdmin)