Add ExportActionMixin (#809)
Transform the ExportActionModelAdmin class into a Mixin
This commit is contained in:
parent
e633f9deb1
commit
2180b14944
|
@ -479,10 +479,9 @@ class ImportExportModelAdmin(ImportExportMixin, admin.ModelAdmin):
|
|||
"""
|
||||
|
||||
|
||||
class ExportActionModelAdmin(ExportMixin, admin.ModelAdmin):
|
||||
class ExportActionMixin(ExportMixin):
|
||||
"""
|
||||
Subclass of ModelAdmin with export functionality implemented as an
|
||||
admin action.
|
||||
Mixin with export functionality implemented as an admin action.
|
||||
"""
|
||||
|
||||
# Don't use custom change list template.
|
||||
|
@ -501,7 +500,7 @@ class ExportActionModelAdmin(ExportMixin, admin.ModelAdmin):
|
|||
choices.append((str(i), f().get_title()))
|
||||
|
||||
self.action_form = export_action_form_factory(choices)
|
||||
super(ExportActionModelAdmin, self).__init__(*args, **kwargs)
|
||||
super(ExportActionMixin, self).__init__(*args, **kwargs)
|
||||
|
||||
def export_admin_action(self, request, queryset):
|
||||
"""
|
||||
|
@ -531,6 +530,13 @@ class ExportActionModelAdmin(ExportMixin, admin.ModelAdmin):
|
|||
js = ['import_export/action_formats.js']
|
||||
|
||||
|
||||
class ExportActionModelAdmin(ExportActionMixin, admin.ModelAdmin):
|
||||
"""
|
||||
Subclass of ModelAdmin with export functionality implemented as an
|
||||
admin action.
|
||||
"""
|
||||
|
||||
|
||||
class ImportExportActionModelAdmin(ImportMixin, ExportActionModelAdmin):
|
||||
"""
|
||||
Subclass of ExportActionModelAdmin with import/export functionality.
|
||||
|
|
Loading…
Reference in New Issue