mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-16 09:37:03 +02:00
put all messages in one warning, rather than multiple
This commit is contained in:
parent
bcbd7927b3
commit
a9a256127a
1 changed files with 7 additions and 6 deletions
|
@ -490,16 +490,17 @@ class ContactAdmin(ListHeaderAdmin):
|
||||||
related_objects.append((change_url, obj))
|
related_objects.append((change_url, obj))
|
||||||
|
|
||||||
if related_objects:
|
if related_objects:
|
||||||
|
message = ""
|
||||||
for url, obj in related_objects:
|
for url, obj in related_objects:
|
||||||
escaped_obj = escape(obj)
|
escaped_obj = escape(obj)
|
||||||
message = f"Joined to {obj.__class__.__name__}: <a href='{url}'>{escaped_obj}</a>"
|
message += f"Joined to {obj.__class__.__name__}: <a href='{url}'>{escaped_obj}</a><br/>"
|
||||||
# message_html is considered safe html. It is generated from a finite list of strings
|
# message_html is considered safe html. It is generated from a finite list of strings
|
||||||
# which are generated from django objects. And a django object, which is escaped
|
# which are generated from django objects. And a django object, which is escaped
|
||||||
message_html = mark_safe(message) # nosec
|
message_html = mark_safe(message) # nosec
|
||||||
messages.warning(
|
messages.warning(
|
||||||
request,
|
request,
|
||||||
message_html,
|
message_html,
|
||||||
)
|
)
|
||||||
|
|
||||||
return super().change_view(request, object_id, form_url, extra_context=extra_context)
|
return super().change_view(request, object_id, form_url, extra_context=extra_context)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue