Mixins

BaseImportExportMixin

class import_export.mixins.BaseImportExportMixin

Base mixin for functionality related to importing and exporting via the Admin interface.

get_resource_classes()

Return subscriptable type (list, tuple, …) containing resource classes

get_resource_index(form)

Return the index of the resource class defined in the form.

Parameters:

form – The form object.

Returns:

The index of the resource as an int.

get_resource_kwargs(request, *args, **kwargs)

Return the kwargs which are to be passed to the Resource constructor. Can be overridden to provide additional kwarg params.

Parameters:
  • request – The request object.

  • args – Positional arguments.

  • kwargs – Keyword arguments.

Returns:

The Resource kwargs (by default, is the kwargs passed).

BaseImportMixin

class import_export.mixins.BaseImportMixin
get_import_formats()

Returns available import formats.

get_import_resource_classes()

Returns ResourceClass subscriptable (list, tuple, …) to use for import.

BaseExportMixin

class import_export.mixins.BaseExportMixin
get_export_formats()

Returns available export formats.

get_export_resource_classes()

Returns ResourceClass subscriptable (list, tuple, …) to use for export.

ExportViewMixin

class import_export.mixins.ExportViewMixin
form_class

alias of SelectableFieldsExportForm

get_export_data(file_format, queryset, *args, **kwargs)

Returns file_format representation for given queryset.

ExportViewFormMixin

class import_export.mixins.ExportViewFormMixin(**kwargs)

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

form_valid(form)

If the form is valid, redirect to the supplied URL.