Adding an Export Format for files in Django Admin

843 Views Asked by At

Helloo,

I have added the ImportExportActionModelAdmin function in my Admin for Project, but I can not find the option to choose the format of the file to download and option to export orders.

I have followed the following documnetation about Import and Export but still the action function didn't appear

https://django-import-export.readthedocs.io/en/latest/getting_started.html#exporting-via-admin-action

How do I add that option to export for different formate when I select orders? This is the print for how I want it to be I got it from tutorial following the same steps in the documentation

enter image description here

Here is the admin.py

def order_pdf(obj):
    return mark_safe('<a href="{}">PDF</a>'.format(reverse('core:admin_order_pdf', args=[obj.id])))


order_pdf.short_description = 'Order PDF'

class OrderAdmin(ImportExportActionModelAdmin):
    list_display = ['id', ....., order_pdf]
1

There are 1 best solutions below

0
On

these are Actions and i recommend to read all the docs about it do the best practice