diff --git a/django/contrib/messages/__init__.py b/django/contrib/messages/__init__.py index 40ba6ea6c7..3b62e0ba54 100644 --- a/django/contrib/messages/__init__.py +++ b/django/contrib/messages/__init__.py @@ -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 diff --git a/docs/ref/contrib/messages.txt b/docs/ref/contrib/messages.txt index b4094c0c13..f5c5621c71 100644 --- a/docs/ref/contrib/messages.txt +++ b/docs/ref/contrib/messages.txt @@ -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: diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt index c78bf65cae..e311e902d8 100644 --- a/docs/releases/1.7.txt +++ b/docs/releases/1.7.txt @@ -464,9 +464,8 @@ Minor features * The :ref:`messages context processor ` 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` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/messages_tests/base.py b/tests/messages_tests/base.py index d89e186278..6fe8892ac1 100644 --- a/tests/messages_tests/base.py +++ b/tests/messages_tests/base.py @@ -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 diff --git a/tests/messages_tests/test_cookie.py b/tests/messages_tests/test_cookie.py index 344df96886..8fd6fa3d61 100644 --- a/tests/messages_tests/test_cookie.py +++ b/tests/messages_tests/test_cookie.py @@ -3,8 +3,7 @@ import random 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, diff --git a/tests/messages_tests/test_session.py b/tests/messages_tests/test_session.py index 07be6063f7..cfc7d3e8c5 100644 --- a/tests/messages_tests/test_session.py +++ b/tests/messages_tests/test_session.py @@ -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 diff --git a/tests/messages_tests/tests.py b/tests/messages_tests/tests.py index 2aa8935474..1ebb6aaba2 100644 --- a/tests/messages_tests/tests.py +++ b/tests/messages_tests/tests.py @@ -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