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
¶ Export mixin.
This is intended to be mixed with django.contrib.admin.ModelAdmin https://docs.djangoproject.com/en/dev/ref/contrib/admin/
-
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
-
get_export_data
(file_format, queryset, *args, **kwargs)¶ Returns file_format representation for given queryset.
-
get_export_form
()¶ Get the form type 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.
-
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
¶ 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/dev/ref/contrib/admin/
-
change_list_template
= 'admin/import_export/change_list_import.html'¶ template for change_list view
-
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.
-
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)
-