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.

change_form_template = 'admin/import_export/change_form.html'

template for change form

export_admin_action(request, queryset)

Action runs on POST from instance action menu (if enabled).

get_actions(request)

Adds the export action to the list of available actions.

show_change_form_export = True

Flag to indicate whether to show ‘export’ button on change form

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 ModelAdmin.

export_form_class

Form class to use for the initial export step. Assign to ExportForm if you would like to disable selectable fields feature.

alias of SelectableFieldsExportForm

export_template_name = 'admin/import_export/export.html'

template for export view

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

Returns file_format representation for given queryset.

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

form class to use for the confirm import step

alias of 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:

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_import_data_kwargs(**kwargs)

Prepare kwargs for import_data.

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()).

get_tmp_storage_class_kwargs()

Override this method to provide additional kwargs to temp storage class.

has_import_permission(request)

Returns whether a request has import permission.

import_action(request, **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_error_display = ('message',)

control which UI elements appear when import errors are displayed. Available options: ‘message’, ‘row’, ‘traceback’

import_export_change_list_template = 'admin/import_export/change_list_import.html'

template for change_list view

import_form_class

form class to use for the initial import step

alias of ImportForm

import_template_name = 'admin/import_export/import.html'

template for import view

process_import(request, **kwargs)

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