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.
-
-
class
import_export.admin.
ExportActionModelAdmin
(*args, **kwargs)¶ Subclass of ModelAdmin with export functionality implemented as an admin action.
-
class
import_export.admin.
ExportMixin
¶ Export mixin.
This is intended to be mixed with django.contrib.admin.ModelAdmin https://docs.djangoproject.com/en/2.1/ref/contrib/admin/#modeladmin-objects
-
change_list_template
= 'admin/import_export/change_list_export.html'¶ template for change_list view
-
export_template_name
= 'admin/import_export/export.html'¶ template for export view
-
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 export formats
-
get_export_data
(file_format, queryset, *args, **kwargs)¶ Returns file_format representation for given queryset.
-
get_export_formats
()¶ Returns available export formats.
-
get_export_queryset
(request)¶ Returns export queryset.
Default implementation respects applied search and filters.
-
get_export_resource_class
()¶ Returns ResourceClass to use for export.
-
has_export_permission
(request)¶ Returns whether a request has export permission.
-
resource_class
= None¶ resource class
-
to_encoding
= 'utf-8'¶ 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
¶ Import and export mixin.
-
change_list_template
= 'admin/import_export/change_list_import_export.html'¶ template for change_list view
-
-
class
import_export.admin.
ImportExportModelAdmin
(model, admin_site)¶ Subclass of ModelAdmin with import/export functionality.
-
class
import_export.admin.
ImportMixin
¶ Import mixin.
This is intended to be mixed with django.contrib.admin.ModelAdmin https://docs.djangoproject.com/en/2.1/ref/contrib/admin/#modeladmin-objects
-
change_list_template
= 'admin/import_export/change_list_import.html'¶ template for change_list view
-
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'¶ import data encoding
-
get_confirm_import_form
()¶ Get the form type (class) used to confirm the import.
-
get_form_kwargs
(form, *args, **kwargs)¶ Prepare/returns kwargs for the import form.
To distinguish between import and confirm import forms, the following approach may be used:
- if isinstance(form, ImportForm):
- # your code here for the import form kwargs # e.g. update.kwargs({…})
- elif isinstance(form, ConfirmImportForm):
- # your code here for the confirm import form kwargs # e.g. update.kwargs({…})
…
-
get_import_data_kwargs
(request, *args, **kwargs)¶ Prepare kwargs for import_data.
-
get_import_form
()¶ Get the form type used to read the import format and file.
-
get_import_formats
()¶ Returns available import formats.
-
get_import_resource_class
()¶ Returns ResourceClass to use for import.
-
get_import_resource_kwargs
(request, *args, **kwargs)¶ Prepares/returns kwargs used when initializing Resource
-
get_resource_class
()¶ Returns ResourceClass
-
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 where no error, save the user uploaded file to a local temp file that will be used by ‘process_import’ for the actual import.
-
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)
-
resource_class
= None¶ resource class
-