question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to add multiple custom exports to ModelAdmin

See original GitHub issue

I would like to be able to export different datasets. I currently have this for exporting a model and related data:

class GameAdmin(ExportMixin, admin.ModelAdmin):
    resource_class = GameResource
    # ...

However Games also have Levels, what I would like is having a mechanism to add multiple custom exports similar to how https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter works:

class GameAdmin(ExportMixin, admin.ModelAdmin):
    resource_class = [LevelsResource, GameResource]
    # ...

Which would let me export Level data.

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
JyothiVutukuricommented, Feb 2, 2021

I think, this issue has to reopen I am using django import and export in django admin

But we want multiple types of export for the same model Eg. We have investors model We want exports like

  1. Investors data for issuing shares
  2. Investors data for compliance data with different fields
  3. Founders to see investors with invested project.
0reactions
ton77vcommented, Jul 31, 2021

having an option to use multiple resource classes will be very handy

I have models with various M2M relationships and sometimes can get export data for only some of those without a need 2 touch the rest

it’s all doable using export first, etc etc + there’s a workaround with Proxy Models but would be much easier to choose the resource class when you need to update just some (sets) of the data

Read more comments on GitHub >

github_iconTop Results From Across the Web

Django import export add on existing admin - Stack Overflow
class BookAdmin(admin.ModelAdmin):. So I need to try to add import/export class with some different name like class BookAdminExport, but then I ...
Read more >
How to Import or Export Data from Django Admin
In this article, I am going to show you a very easy way to add import/export functionality to Django Admin.
Read more >
Django Import Export Tricks & Tips - Dev Genius
Django Import Export Tricks & Tips · Look Up in Foreignkey and ManyToMany fields · Custom Dropdown Widgets · Skip Rows (Avoid Duplicate...
Read more >
2. How to export CSV from Django admin? - Books by Agiliq
You have been asked to add ability to export Hero and Villain from the admin. There are a number of third party apps...
Read more >
Admin actions - Django documentation
If you wish to override this behavior, you can override ModelAdmin.delete_queryset() or write a custom action which does deletion in your preferred manner ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found