Admin

For instructions on how to use the models and mixins in this module, please refer to Admin integration.

class import_export.admin.ExportActionMixin(*args, **kwargs)

Mixin with export functionality implemented as an admin action.

export_admin_action(request, queryset)

Exports the selected rows using file_format.

get_actions(request)

Adds the export action to the list of available actions.

class import_export.admin.ExportActionModelAdmin(*args, **kwargs)

Subclass of ModelAdmin with export functionality implemented as an admin action.

class import_export.admin.ExportMixin(*args, **kwargs)

Export mixin.

This is intended to be mixed with django.contrib.admin.ModelAdmin https://docs.djangoproject.com/en/dev/ref/contrib/admin/

export_form_class

alias of import_export.forms.ExportForm

export_template_name = 'admin/import_export/export.html'

template for export view

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

Returns file_format representation for given queryset.

get_export_form()

Deprecated since version 3.0: Use get_export_form_class() or set the new export_form_class attribute.

get_export_form_class()

Get the form class used to read the export format.

get_export_queryset(request)

Returns export queryset.

Default implementation respects applied search and filters.

has_export_permission(request)

Returns whether a request has export permission.

import_export_change_list_template = 'admin/import_export/change_list_export.html'

template for change_list view

to_encoding = None

export data encoding

class import_export.admin.ImportExportActionModelAdmin(*args, **kwargs)

Subclass of ExportActionModelAdmin with import/export functionality. Export functionality is implemented as an admin action.

class import_export.admin.ImportExportMixin(*args, **kwargs)

Import and export mixin.

import_export_change_list_template = 'admin/import_export/change_list_import_export.html'

template for change_list view

class import_export.admin.ImportExportModelAdmin(*args, **kwargs)

Subclass of ModelAdmin with import/export functionality.

class import_export.admin.ImportMixin(*args, **kwargs)

Import mixin.

This is intended to be mixed with django.contrib.admin.ModelAdmin https://docs.djangoproject.com/en/dev/ref/contrib/admin/

confirm_form_class

alias of import_export.forms.ConfirmImportForm

create_confirm_form(request, import_form=None)

New in version 3.0.

Return a form instance to use for the ‘confirm’ import step. This method can be extended to make dynamic form updates to the form after it has been instantiated. You might also look to override the following:

create_import_form(request)

New in version 3.0.

Return a form instance to use for the ‘initial’ import step. This method can be extended to make dynamic form updates to the form after it has been instantiated. You might also look to override the following:

formats = [<class 'import_export.formats.base_formats.CSV'>, <class 'import_export.formats.base_formats.XLS'>, <class 'import_export.formats.base_formats.XLSX'>, <class 'import_export.formats.base_formats.TSV'>, <class 'import_export.formats.base_formats.ODS'>, <class 'import_export.formats.base_formats.JSON'>, <class 'import_export.formats.base_formats.YAML'>, <class 'import_export.formats.base_formats.HTML'>]

available import formats

from_encoding = 'utf-8-sig'

import data encoding

get_confirm_form_class(request)

New in version 3.0.

Return the form class to use for the ‘confirm’ import step. If you only have a single custom form class, you can set the confirm_form_class attribute to change this for your subclass.

get_confirm_form_initial(request, import_form)

New in version 3.0.

Return a dictionary of initial field values to be provided to the ‘confirm’ form.

get_confirm_form_kwargs(request, import_form=None)

New in version 3.0.

Return a dictionary of values with which to initialize the ‘confirm’ form (including the initial values returned by get_confirm_form_initial()).

get_confirm_import_form()

Deprecated since version 3.0: Use get_confirm_form_class() or set the new confirm_form_class attribute.

get_form_kwargs(form, *args, **kwargs)

Deprecated since version 3.0: Use get_import_form_kwargs() or get_confirm_form_kwargs() instead, depending on which form you wish to customize.

get_import_data_kwargs(request, *args, **kwargs)

Prepare kwargs for import_data.

get_import_form()

Deprecated since version 3.0: Use get_import_form_class() or set the new import_form_class attribute.

get_import_form_class(request)

New in version 3.0.

Return the form class to use for the ‘import’ step. If you only have a single custom form class, you can set the import_form_class attribute to change this for your subclass.

get_import_form_initial(request)

New in version 3.0.

Return a dictionary of initial field values to be provided to the ‘import’ form.

get_import_form_kwargs(request)

New in version 3.0.

Return a dictionary of values with which to initialize the ‘import’ form (including the initial values returned by get_import_form_initial()).

has_import_permission(request)

Returns whether a request has import permission.

import_action(request, *args, **kwargs)

Perform a dry_run of the import to make sure the import will not result in errors. If there are no errors, save the user uploaded file to a local temp file that will be used by ‘process_import’ for the actual import.

import_export_change_list_template = 'admin/import_export/change_list_import.html'

template for change_list view

import_form_class

alias of import_export.forms.ImportForm

import_template_name = 'admin/import_export/import.html'

template for import view

process_import(request, *args, **kwargs)

Perform the actual import action (after the user has confirmed the import)