loar
loar

Reputation: 1745

Django import-export: only export

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?

Upvotes: 12

Views: 6177

Answers (3)

user2947136
user2947136

Reputation: 751

from import_export.admin import ExportMixin

class BookAdmin(ExportMixin, admin.ModelAdmin):

Upvotes: 34

Taranjeet
Taranjeet

Reputation: 581

If you want the action of Export Selected Books, you can use

class BookAdmin(ExportActionModelAdmin,admin.ModelAdmin):

Upvotes: 5

viirus
viirus

Reputation: 1047

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):

Upvotes: 2

Related Questions