Skip to content

Commit

Permalink
[#2912] Fix styling for zgw import-export error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pi-sigma committed Nov 28, 2024
1 parent e589b3a commit dc7f227
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
10 changes: 4 additions & 6 deletions src/open_inwoner/openzaak/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,13 @@ def process_file_view(self, request):
error_msg_iterator = ([msg] for msg in msgs_deduped)

error_msg_html = format_html_join(
"\n", "<li>{}</li>", error_msg_iterator
"\n", "<p> - {}</p>", error_msg_iterator
)
error_msg_html_ordered = format_html(
error_msg_html = format_html(
_("It was not possible to import the following items:")
+ f"<ol> {error_msg_html} </ol>"
)
self.message_user(
request, error_msg_html_ordered, messages.ERROR
+ f"<div>{error_msg_html}</div>"
)
self.message_user(request, error_msg_html, messages.ERROR)

return HttpResponseRedirect(
reverse(
Expand Down
18 changes: 9 additions & 9 deletions src/open_inwoner/openzaak/import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,25 @@ def extract_error_data(cls, exc: Exception, jsonl: str):
fields = data.get("fields", None)
if source_config is CatalogusConfig:
items = [
f"Domein = {fields['domein']}",
f"Rsin = {fields['rsin']}",
f"Domein = {fields['domein']!r}",
f"Rsin = {fields['rsin']!r}",
]
if source_config is ZaakTypeConfig:
items = [
f"Identificatie = {fields['identificatie']}",
f"Catalogus domein = {fields['catalogus'][0]}",
f"Catalogus rsin = {fields['catalogus'][1]}",
f"Identificatie = {fields['identificatie']!r}",
f"Catalogus domein = {fields['catalogus'][0]!r}",
f"Catalogus rsin = {fields['catalogus'][1]!r}",
]
if source_config in {
ZaakTypeStatusTypeConfig,
ZaakTypeResultaatTypeConfig,
ZaakTypeInformatieObjectTypeConfig,
}:
items = [
f"omschrijving = {fields['omschrijving']}",
f"ZaakTypeConfig identificatie = {fields['zaaktype_config'][0]}",
f"Catalogus domein = {fields['zaaktype_config'][1]}",
f"Catalogus rsin = {fields['zaaktype_config'][2]}",
f"omschrijving = {fields['omschrijving']!r}",
f"ZaakTypeConfig identificatie = {fields['zaaktype_config'][0]!r}",
f"Catalogus domein = {fields['zaaktype_config'][1]!r}",
f"Catalogus rsin = {fields['zaaktype_config'][2]!r}",
]

return {
Expand Down

0 comments on commit dc7f227

Please sign in to comment.