1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Refs #34730 -- Made Message importable from django.contrib.messages.

This commit is contained in:
François Freitag 2023-08-25 06:54:12 +02:00 committed by Mariusz Felisiak
parent 1081d24f99
commit b7fe36ad37
7 changed files with 8 additions and 12 deletions

View File

@ -1,2 +1,3 @@
from django.contrib.messages.api import * # NOQA from django.contrib.messages.api import * # NOQA
from django.contrib.messages.constants import * # NOQA from django.contrib.messages.constants import * # NOQA
from django.contrib.messages.storage.base import Message # NOQA

View File

@ -238,7 +238,7 @@ instance of the configured storage backend.
The ``Message`` class The ``Message`` class
--------------------- ---------------------
.. class:: storage.base.Message .. class:: Message
When you loop over the list of messages in a template, what you get are 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: instances of the ``Message`` class. They have only a few attributes:

View File

@ -464,9 +464,8 @@ Minor features
* The :ref:`messages context processor <message-displaying>` now adds a * The :ref:`messages context processor <message-displaying>` now adds a
dictionary of default levels under the name ``DEFAULT_MESSAGE_LEVELS``. dictionary of default levels under the name ``DEFAULT_MESSAGE_LEVELS``.
* :class:`~django.contrib.messages.storage.base.Message` objects now have a * :class:`~django.contrib.messages.Message` objects now have a ``level_tag``
``level_tag`` attribute that contains the string representation of the attribute that contains the string representation of the message level.
message level.
:mod:`django.contrib.redirects` :mod:`django.contrib.redirects`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -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.api import MessageFailure
from django.contrib.messages.constants import DEFAULT_LEVELS from django.contrib.messages.constants import DEFAULT_LEVELS
from django.contrib.messages.storage import default_storage from django.contrib.messages.storage import default_storage
from django.contrib.messages.storage.base import Message
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from django.test import modify_settings, override_settings from django.test import modify_settings, override_settings
from django.urls import reverse from django.urls import reverse

View File

@ -3,8 +3,7 @@ import random
from unittest import TestCase from unittest import TestCase
from django.conf import settings from django.conf import settings
from django.contrib.messages import constants from django.contrib.messages import Message, constants
from django.contrib.messages.storage.base import Message
from django.contrib.messages.storage.cookie import ( from django.contrib.messages.storage.cookie import (
CookieStorage, CookieStorage,
MessageDecoder, MessageDecoder,

View File

@ -1,5 +1,4 @@
from django.contrib.messages import constants from django.contrib.messages import Message, constants
from django.contrib.messages.storage.base import Message
from django.contrib.messages.storage.session import SessionStorage from django.contrib.messages.storage.session import SessionStorage
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest from django.http import HttpRequest

View File

@ -1,8 +1,7 @@
from unittest import mock 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 import base
from django.contrib.messages.storage.base import Message
from django.test import SimpleTestCase, override_settings from django.test import SimpleTestCase, override_settings