Skip to content

Commit

Permalink
Merge pull request #2481 from cisagov/bob/1762-joined-messages-bug
Browse files Browse the repository at this point in the history
Issue #1762: Clear warning messages on Contact save
  • Loading branch information
dave-kennedy-ecs authored Jul 24, 2024
2 parents 20f075a + 53573a8 commit af45eb5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/registrar/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,16 @@ def changelist_view(self, request, extra_context=None):
# Get the filtered values
return super().changelist_view(request, extra_context=extra_context)

def save_model(self, request, obj, form, change):
# Clear warning messages before saving
storage = messages.get_messages(request)
storage.used = False
for message in storage:
if message.level == messages.WARNING:
storage.used = True

return super().save_model(request, obj, form, change)


class SeniorOfficialAdmin(ListHeaderAdmin):
"""Custom Senior Official Admin class."""
Expand Down

0 comments on commit af45eb5

Please sign in to comment.