Skip to content

Commit

Permalink
Refs #34730 -- Made Message importable from django.contrib.messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisfreitag authored and felixxm committed Aug 25, 2023
1 parent 1081d24 commit b7fe36a
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
1 change: 1 addition & 0 deletions django/contrib/messages/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from django.contrib.messages.api import * # NOQA
from django.contrib.messages.constants import * # NOQA
from django.contrib.messages.storage.base import Message # NOQA
2 changes: 1 addition & 1 deletion docs/ref/contrib/messages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ instance of the configured storage backend.
The ``Message`` class
---------------------

.. class:: storage.base.Message
.. class:: Message

When you loop over the list of messages in a template, what you get are
instances of the ``Message`` class. They have only a few attributes:
Expand Down
5 changes: 2 additions & 3 deletions docs/releases/1.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,8 @@ Minor features
* The :ref:`messages context processor <message-displaying>` now adds a
dictionary of default levels under the name ``DEFAULT_MESSAGE_LEVELS``.

* :class:`~django.contrib.messages.storage.base.Message` objects now have a
``level_tag`` attribute that contains the string representation of the
message level.
* :class:`~django.contrib.messages.Message` objects now have a ``level_tag``
attribute that contains the string representation of the message level.

:mod:`django.contrib.redirects`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
3 changes: 1 addition & 2 deletions tests/messages_tests/base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from django.contrib.messages import constants, get_level, set_level
from django.contrib.messages import Message, constants, get_level, set_level
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.constants import DEFAULT_LEVELS
from django.contrib.messages.storage import default_storage
from django.contrib.messages.storage.base import Message
from django.http import HttpRequest, HttpResponse
from django.test import modify_settings, override_settings
from django.urls import reverse
Expand Down
3 changes: 1 addition & 2 deletions tests/messages_tests/test_cookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from unittest import TestCase

from django.conf import settings
from django.contrib.messages import constants
from django.contrib.messages.storage.base import Message
from django.contrib.messages import Message, constants
from django.contrib.messages.storage.cookie import (
CookieStorage,
MessageDecoder,
Expand Down
3 changes: 1 addition & 2 deletions tests/messages_tests/test_session.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.contrib.messages import constants
from django.contrib.messages.storage.base import Message
from django.contrib.messages import Message, constants
from django.contrib.messages.storage.session import SessionStorage
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest
Expand Down
3 changes: 1 addition & 2 deletions tests/messages_tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from unittest import mock

from django.contrib.messages import constants
from django.contrib.messages import Message, constants
from django.contrib.messages.storage import base
from django.contrib.messages.storage.base import Message
from django.test import SimpleTestCase, override_settings


Expand Down

0 comments on commit b7fe36a

Please sign in to comment.