Code

Ticket #16884: message-user-level.diff

File message-user-level.diff, 782 bytes (added by shelldweller, 3 years ago)
Line 
1Index: django/contrib/admin/options.py
2===================================================================
3--- django/contrib/admin/options.py     (revision 16855)
4+++ django/contrib/admin/options.py     (working copy)
5@@ -672,12 +672,12 @@
6         change_message = ' '.join(change_message)
7         return change_message or _('No fields changed.')
8 
9-    def message_user(self, request, message):
10+    def message_user(self, request, message, level=messages.INFO):
11         """
12         Send a message to the user. The default implementation
13         posts a message using the django.contrib.messages backend.
14         """
15-        messages.info(request, message)
16+        messages.add_message(request, level, message)
17 
18     def save_form(self, request, form, change):
19         """