diff --git a/sigi/apps/utils/mixins.py b/sigi/apps/utils/mixins.py index e973c23..9d15f0a 100644 --- a/sigi/apps/utils/mixins.py +++ b/sigi/apps/utils/mixins.py @@ -12,7 +12,7 @@ from django.template.response import TemplateResponse from django.urls import path from django.utils.translation import gettext as _, ngettext from import_export import resources -from import_export.admin import ExportMixin +from import_export.admin import ImportMixin, ExportMixin from import_export.fields import Field from import_export.forms import ExportForm from import_export.signals import post_export @@ -243,6 +243,15 @@ class CartExportMixin(ExportMixin): return TemplateResponse(request, [self.export_template_name], context) +class ImportCartExportMixin(ImportMixin, CartExportMixin): + """ + Import and export mixin. + """ + + #: template for change_list view + change_list_template = "admin/cart/change_list_import_cart_export.html" + + class CartExportReportMixin(CartExportMixin): export_template_name = "admin/import_export/export_report.html" reports = [] diff --git a/sigi/apps/utils/templates/admin/cart/change_list_import_cart_export.html b/sigi/apps/utils/templates/admin/cart/change_list_import_cart_export.html new file mode 100644 index 0000000..e956342 --- /dev/null +++ b/sigi/apps/utils/templates/admin/cart/change_list_import_cart_export.html @@ -0,0 +1,6 @@ +{% extends "admin/cart/change_list_cart_export.html" %} + +{% block object-tools-items %} + {% include "admin/import_export/change_list_import_item.html" %} + {{ block.super }} +{% endblock %} diff --git a/sigi/apps/utils/templates/admin/import_export/change_list.html b/sigi/apps/utils/templates/admin/import_export/change_list.html new file mode 100644 index 0000000..239b1bf --- /dev/null +++ b/sigi/apps/utils/templates/admin/import_export/change_list.html @@ -0,0 +1 @@ +{% extends "admin/change_list.html" %} diff --git a/sigi/apps/utils/templates/admin/import_export/change_list_export_item.html b/sigi/apps/utils/templates/admin/import_export/change_list_export_item.html index 4fb7ccb..99c2356 100644 --- a/sigi/apps/utils/templates/admin/import_export/change_list_export_item.html +++ b/sigi/apps/utils/templates/admin/import_export/change_list_export_item.html @@ -4,7 +4,7 @@ {% if has_export_permission %}