Skip to content

Commit

Permalink
Add more customizable blocks in import.html (#1598)
Browse files Browse the repository at this point in the history
* Add more customizable blocks in import.html

* Update changelog.rst

---------

Co-authored-by: Matt Hegarty <matthewhegarty@users.noreply.github.com>
  • Loading branch information
christophehenry and matthewhegarty committed Jul 20, 2023
1 parent 7a6fb7e commit 042eec4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 29 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -141,3 +141,4 @@ The following is a list of much appreciated contributors:
* smunoz-ml (Santiago Muñoz)
* carlosal0ns0 (Carlos Alonso)
* travenin (Lauri Virtanen)
* christophehenry (Christophe Henry)
1 change: 1 addition & 0 deletions docs/changelog.rst
Expand Up @@ -8,6 +8,7 @@ Changelog
- Refactoring and fix to support filtering exports (#1579)
- Store ``instance`` and ``original`` object in :class:`~import_export.results.RowResult` (#1584)
- Removed reference to tablib dev from tox build (#1603)
- Add customizable blocks in import.html (#1598)

3.2.0 (2023-04-12)
------------------
Expand Down
64 changes: 35 additions & 29 deletions import_export/templates/admin/import_export/import.html
Expand Up @@ -39,39 +39,45 @@
<form action="" method="post" enctype="multipart/form-data">
{% csrf_token %}

<p>
{% trans "This importer will import the following fields: " %}
{% if fields_list|length <= 1 %}
<code>{{ fields_list.0.1|join:", " }}</code>
{% else %}
<dl>
{% for resource, fields in fields_list %}
<dt>{{ resource }}</dt>
<dd><code>{{ fields|join:", " }}</code></dd>
{% endfor %}
</dl>
{% endif %}
</p>
{% block fields_help %}
<p>
{% trans "This importer will import the following fields: " %}
{% if fields_list|length <= 1 %}
<code>{{ fields_list.0.1|join:", " }}</code>
{% else %}
<dl>
{% for resource, fields in fields_list %}
<dt>{{ resource }}</dt>
<dd><code>{{ fields|join:", " }}</code></dd>
{% endfor %}
</dl>
{% endif %}
</p>
{% endblock %}

<fieldset class="module aligned">
{% for field in form %}
<div class="form-row">
{{ field.errors }}
{% block form_detail %}
<fieldset class="module aligned">
{% for field in form %}
<div class="form-row">
{{ field.errors }}

{{ field.label_tag }}
{{ field.label_tag }}

{{ field }}
{{ field }}

{% if field.field.help_text %}
<p class="help">{{ field.field.help_text|safe }}</p>
{% endif %}
</div>
{% endfor %}
</fieldset>
{% if field.field.help_text %}
<p class="help">{{ field.field.help_text|safe }}</p>
{% endif %}
</div>
{% endfor %}
</fieldset>
{% endblock %}

<div class="submit-row">
<input type="submit" class="default" value="{% trans "Submit" %}">
</div>
{% block form_submit_button %}
<div class="submit-row">
<input type="submit" class="default" value="{% trans "Submit" %}">
</div>
{% endblock %}
</form>
{% endblock %}
{% endif %}
Expand Down Expand Up @@ -156,7 +162,7 @@ <h2>{% trans "Some rows failed to validate" %}</h2>
</tbody>
</table>
{% endblock %}

{% else %}

{% block preview %}
Expand Down

0 comments on commit 042eec4

Please sign in to comment.