Mixins

BaseImportExportMixin

class import_export.mixins.BaseImportExportMixin

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

get_resource_classes(request)

Return subscriptable type (list, tuple, …) containing resource classes :param request: The request object. :returns: The 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.

  • kwargs – Keyword arguments.

Returns:

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

BaseImportMixin

class import_export.mixins.BaseImportMixin
choose_import_resource_class(form, request)

Identify which class should be used for import :param form: The form object. :param request: The request object. :returns: The import Resource class.

get_import_formats()

Returns available import formats.

get_import_resource_classes(request)
Parameters:

request – The request object.

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

get_import_resource_kwargs(request, **kwargs)

Returns kwargs which will be passed to the Resource constructor. :param request: The request object. :param kwargs: Keyword arguments. :returns: The kwargs (dict)

skip_import_confirm = False

If enabled, the import workflow skips the import confirm page and imports the data directly. See IMPORT_EXPORT_SKIP_ADMIN_CONFIRM.

BaseExportMixin

class import_export.mixins.BaseExportMixin
choose_export_resource_class(form, request)

Identify which class should be used for export :param request: The request object. :param form: The form object. :returns: The export Resource class.

get_export_formats()

Returns available export formats.

get_export_resource_classes(request)

Returns ResourceClass subscriptable (list, tuple, …) to use for export. :param request: The request object. :returns: The Resource classes.

get_export_resource_kwargs(request, **kwargs)

Returns kwargs which will be passed to the Resource constructor. :param request: The request object. :param kwargs: Keyword arguments. :returns: The kwargs (dict)

skip_export_form = False

If enabled, the export workflow skips the export form and exports the data directly. See IMPORT_EXPORT_SKIP_ADMIN_EXPORT_UI.

skip_export_form_from_action = False

If enabled, the export workflow from Admin UI action menu skips the export form and exports the data directly. See IMPORT_EXPORT_SKIP_ADMIN_ACTION_EXPORT_UI.

ExportViewMixin

class import_export.mixins.ExportViewMixin
form_class

alias of SelectableFieldsExportForm

get_export_data(file_format, queryset, **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.