I found with django-import-export, the import fields and export fields is the same, but I want to set different fields when importing and exporting, I don't know whether django-import-export support that?
Off course, use 2 resources.
hi @bmihelac , can I ask a simple example 馃槉 , I am not actually understand the documentation. 馃槩
This would use BookResource for import and ExportBookResouce for export.
class BookAdmin(ImportExportModelAdmin):
resource_class = BookResource
def get_export_resource_class(self):
"""
Returns ResourceClass to use for export.
"""
return ExportBookResource
Have you tried overriding Resource.get_export_fields()? https://github.com/django-import-export/django-import-export/blob/master/import_export/resources.py#L597
We use that to change both what fields are visible on the import screen, as well as what fields get exported.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
This would use BookResource for import and ExportBookResouce for export.