Skip to content

Commit

Permalink
Merge branch 'release-4' into issue-1359-error-information
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhegarty committed Jan 8, 2024
2 parents 9b10a05 + a78396b commit f60c7e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion import_export/templates/admin/import_export/import.html
Expand Up @@ -85,12 +85,13 @@ <h2>{% translate "Errors" %}</h2>
<div class="traceback">{{ error.traceback|linebreaks }}</div>
</li>
{% endfor %}
{% block import_error_list %}
{% for line, errors in result.row_errors %}
{% for error in errors %}
{% block import_error_list_item %}
<li class="import-error-li">
{% if "message" in import_error_display %}
<div class="import-error-display-message">{% translate "Row number" %}: {{ line }} - {{ error.error }}</div>
<div class="import-error-display-message">{% translate "Line number" %}: {{ line }} - {{ error.error }}</div>
{% endif %}
{% if "row" in import_error_display %}
<div class="import-error-display-row">{{ error.row.values|join:", " }}</div>
Expand All @@ -99,8 +100,10 @@ <h2>{% translate "Errors" %}</h2>
<div class="import-error-display-traceback">{{ error.traceback|linebreaks }}</div>
{% endif %}
</li>
{% endblock %}
{% endfor %}
{% endfor %}
{% endblock %}
</ul>
{% endblock %}

Expand Down
4 changes: 2 additions & 2 deletions tests/core/tests/admin_integration/test_import.py
Expand Up @@ -504,7 +504,7 @@ def test_result_error_display_default(self):
response.render()
self.assertIn("import-error-display-message", str(response.content))
self.assertIn(
"Row number: 1 - Author matching query does not exist.",
"Line number: 1 - Author matching query does not exist.",
str(response.content),
)
self.assertNotIn("import-error-display-row", str(response.content))
Expand All @@ -517,7 +517,7 @@ def test_result_error_display_message_only(self):
response = self.model_admin.import_action(self.request)
response.render()
self.assertIn(
"Row number: 1 - Author matching query does not exist.",
"Line number: 1 - Author matching query does not exist.",
str(response.content),
)
self.assertIn("import-error-display-message", str(response.content))
Expand Down

0 comments on commit f60c7e9

Please sign in to comment.