Skip to content

Commit

Permalink
Clear warning messages on Contact save
Browse files Browse the repository at this point in the history
  • Loading branch information
rachidatecs committed Jul 19, 2024
1 parent acf5276 commit 53573a8
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 @@ -1001,6 +1001,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 53573a8

Please sign in to comment.