jrief / django-admin-sortable2

Generic drag-and-drop ordering for objects in the Django admin interface
https://django-admin-sortable2.readthedocs.io/en/latest/
Other
770 stars 180 forks source link

SortableAdminMixin not compatible with other mixins (at least ImportExportMixin from django-import-export) #316

Closed PetrDlouhy closed 2 years ago

PetrDlouhy commented 2 years ago

When combining multiple mixins, the functionality of each other can be overlapping. E.g. with ImportExportMixin:

If I use the mixins in this order:

class MyAdmin(ImportExportMixin, SortableAdminMixin, admin.ModelAdmin):

I will see the Import/Export buttons, but the ordering of rows doesn't work (admin_sortable2_config element is missing).

When used in this order:

class MyAdmin(SortableAdminMixin, ImportExportMixin, admin.ModelAdmin):

The ordering works, but the Import/Export buttons are not visible.

This issue has already been fixed in PR #192, but has been reverted since then because it caused unspecified problems. Because I again bumped into this problem in 2.0.3 I would like to resolve the problems with the original PR and get this issue fixed.