I'm using the third party library Django-import-export for importing/exporting data.
It's working properly but I only want the export functionality (not import one).
How could I use only export without import?
I'm using the third party library Django-import-export for importing/exporting data.
It's working properly but I only want the export functionality (not import one).
How could I use only export without import?
from import_export.admin import ExportMixin
class BookAdmin(ExportMixin, admin.ModelAdmin):
admin.ModelAdmin
is a subclass of django.contrib
or, in full, django.contrib.admin.ModelAdmin
and not a subclass of import_export.admin
: See here. –
Alleris from import_export.admin import ExportMixin
–
Pitiless If you want the action of Export Selected Books
, you can use
class BookAdmin(ExportActionModelAdmin,admin.ModelAdmin):
As your question is not really described, I can only guess, that you want to remove the "import" button in the Admin view?
As described here you have to set the ExportMixin on your ModelAdmin. So it looks something like this
class BookAdmin(ExportMixin, ModelAdmin):
© 2022 - 2024 — McMap. All rights reserved.