Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle ValidationErrors having just plain messages list #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions import_export_celery/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,23 @@ def before_import_row(self, row, **kwargs):
cols = lambda row: "</td><td>".join(
[str(field) for field in row.values]
)
cols_error = lambda row: "".join(
[
"<mark>"
+ key
+ "</mark>"
+ "<br>"
+ row.error.message_dict[key][0]
+ "<br>"
for key in row.error.message_dict.keys()
]
)

def cols_error(row):
if hasattr(row.error, "message_dict"):
return "".join(
[
"<mark>"
+ key
+ "</mark>"
+ "<br>"
+ row.error.message_dict[key][0]
+ "<br>"
for key in row.error.message_dict.keys()
]
)
else:
return "".join(message + "<br>" for message in row.error.messages)

summary += (
"<tr><td>row</td>"
+ "<td>errors</td><td>"
Expand Down