From 81b227dd8b1da3c644083c7a72a2bfd8ebb9f354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Thu, 6 Mar 2025 15:53:32 -0300 Subject: [PATCH] Import e export para bootstrap --- sigi/templates/admin/import_export/base.html | 19 +--- .../admin/import_export/change_form.html | 1 + .../templates/admin/import_export/export.html | 107 ++++++++---------- .../import_export/resource_fields_list.html | 24 ++++ sigi/templates/admin/submit_line.html | 12 ++ 5 files changed, 89 insertions(+), 74 deletions(-) create mode 100644 sigi/templates/admin/import_export/change_form.html create mode 100644 sigi/templates/admin/import_export/resource_fields_list.html create mode 100644 sigi/templates/admin/submit_line.html diff --git a/sigi/templates/admin/import_export/base.html b/sigi/templates/admin/import_export/base.html index 1a7f6cf..a98b321 100644 --- a/sigi/templates/admin/import_export/base.html +++ b/sigi/templates/admin/import_export/base.html @@ -1,22 +1,13 @@ {% extends "admin/base_site.html" %} -{% load i18n admin_modify %} -{% load admin_urls %} -{% load static %} +{% load i18n admin_modify admin_urls static %} {% block extrastyle %}{{ block.super }}{% endblock %} {% if not is_popup %} - {% block nav-breadcrumbs %} - + {% block breadcrumbs %} + + + {% block breadcrumbs_last %}{% endblock %} {% endblock %} {% endif %} diff --git a/sigi/templates/admin/import_export/change_form.html b/sigi/templates/admin/import_export/change_form.html new file mode 100644 index 0000000..eb993cf --- /dev/null +++ b/sigi/templates/admin/import_export/change_form.html @@ -0,0 +1 @@ +{% extends "admin/change_form.html" %} \ No newline at end of file diff --git a/sigi/templates/admin/import_export/export.html b/sigi/templates/admin/import_export/export.html index dc6870d..1c4285f 100644 --- a/sigi/templates/admin/import_export/export.html +++ b/sigi/templates/admin/import_export/export.html @@ -10,71 +10,58 @@ {% endblock %} {% block breadcrumbs_last %} -{% translate "Export" %} + {% endblock %} {% block content %} -{% if form.errors %} - {{ form.errors }} -{% endif %} -
- {% csrf_token %} - {# Export request has originated from an Admin UI action #} - {% if form.initial.export_items %} -

- {% blocktranslate count len=form.initial.export_items|length %} - Export {{ len }} selected item. - {% plural %} - Export {{ len }} selected items. - {% endblocktranslate %} -

+ {% if form.errors %} + {{ form.errors }} {% endif %} + {% csrf_token %} + {% for field in form.hidden_fields %} + {{ field }} + {% endfor %} + {# Export request has originated from an Admin UI action #} + {% if form.initial.export_items %} + + {% endif %} - {# Fields list is not required with selectable fields form #} - {% if not form.is_selectable_fields_form %} - {% include "admin/import_export/resource_fields_list.html" with import_or_export="export" %} - {% endif %} -

+ {# Fields list is not required with selectable fields form #} + {% if not form.is_selectable_fields_form %} + {% include "admin/import_export/resource_fields_list.html" with import_or_export="export" %} + {% endif %} -
-

{% translate "This exporter will export the following fields:" %}

- -
- {% for field in form.visible_fields %} - {% if field.name != "format" %} {# Excluindo o campo "Formato" da lista automática #} -
-
-
- - {{ field }} - {% if field.field.help_text %} - - {{ field.field.help_text|safe }} - - {% endif %} -
-
-
- {% endif %} - {% endfor %} +
+ {{ form.format.label_tag }}
{{ form.format }}
+
- - {% for field in form.hidden_fields %} - {{ field }} - {% endfor %} -
- - {# Campo "Formato" separado, posicionado de forma independente #} -
- - {{ form.format }} -
- -
- -
- -
+ +
+
+ {% translate "This exporter will export the following fields:" %} +
+
+ {% for field in form.visible_fields %} + {% if field.name != "format" %} {# Excluindo o campo "Formato" da lista automática #} +
+ {{ field.as_field_group }} + {% if field.field.help_text %} + + {{ field.field.help_text|safe }} + + {% endif %} +
+ {% endif %} + {% endfor %} +
+ +
+ {% endblock %} diff --git a/sigi/templates/admin/import_export/resource_fields_list.html b/sigi/templates/admin/import_export/resource_fields_list.html new file mode 100644 index 0000000..21b934e --- /dev/null +++ b/sigi/templates/admin/import_export/resource_fields_list.html @@ -0,0 +1,24 @@ +{% load i18n %} +{% block fields_help %} +
+
+ {% if import_or_export == "export" %} + {% translate "This exporter will export the following fields: " %} + {% elif import_or_export == "import" %} + {% translate "This importer will import the following fields: " %} + {% endif %} +
+
+ {% if fields_list|length <= 1 %} + {{ fields_list.0.1|join:", " }} + {% else %} +
+ {% for resource, fields in fields_list %} +
{{ resource }}
+
{{ fields|join:", " }}
+ {% endfor %} +
+ {% endif %} +
+
+{% endblock %} diff --git a/sigi/templates/admin/submit_line.html b/sigi/templates/admin/submit_line.html new file mode 100644 index 0000000..b00a012 --- /dev/null +++ b/sigi/templates/admin/submit_line.html @@ -0,0 +1,12 @@ +{% extends "admin/submit_line.html" %} +{% load i18n djbs_extras %} + +{% block submit-row %} + {{ block.super }} + {% if show_change_form_export %} + + {% endif %} +{% endblock %} \ No newline at end of file