summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2015-12-26 19:51:22 +0100
committerClaude Paroz <claude@2xlibre.net>2016-01-08 20:34:59 +0100
commitcf7894be88f6c27680ef80796b883f6e3b709b8b (patch)
tree6620fd9dea735a2b91ccde0a7168d3098823e0fb /docs
parent56aaae58a746eb39d5e92ba60f59f4c750a8e1a8 (diff)
Fixed #21113 -- Made LogEntry.change_message language independent
Thanks Tim Graham for the review.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/admin/index.txt21
-rw-r--r--docs/releases/1.10.txt9
2 files changed, 29 insertions, 1 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 35c787ec1b..f6ed8f8e13 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -2823,7 +2823,18 @@ password box.
.. attribute:: LogEntry.change_message
The detailed description of the modification. In the case of an edit, for
- example, the message contains a list of the edited fields.
+ example, the message contains a list of the edited fields. The Django admin
+ site formats this content as a JSON structure, so that
+ :meth:`get_change_message` can recompose a message translated in the current
+ user language. Custom code might set this as a plain string though. You are
+ advised to use the :meth:`get_change_message` method to retrieve this value
+ instead of accessing it directly.
+
+ .. versionchanged:: 1.10
+
+ Previously, this attribute was always a plain string. It is
+ now JSON-structured so that the message can be translated in the current
+ user language. Old messages are untouched.
``LogEntry`` methods
--------------------
@@ -2832,6 +2843,14 @@ password box.
A shortcut that returns the referenced object.
+.. method:: LogEntry.get_change_message()
+
+ .. versionadded:: 1.10
+
+ Formats and translates :attr:`change_message` into the current user
+ language. Messages created before Django 1.10 will always be displayed in
+ the language in which they were logged.
+
.. currentmodule:: django.contrib.admin
.. _admin-reverse-urls:
diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt
index 6ca1d3d4f6..cf9b67d2d0 100644
--- a/docs/releases/1.10.txt
+++ b/docs/releases/1.10.txt
@@ -51,6 +51,11 @@ Minor features
model's changelist will now be rendered (without the add button, of course).
This makes it easier to add custom tools in this case.
+* The :class:`~django.contrib.admin.models.LogEntry` model now stores change
+ messages in a JSON structure so that the message can be dynamically translated
+ using the current active language. A new ``LogEntry.get_change_message()``
+ method is now the preferred way of retrieving the change message.
+
:mod:`django.contrib.admindocs`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -417,6 +422,10 @@ Miscellaneous
* :djadmin:`loaddata` now raises a ``CommandError`` instead of showing a
warning when the specified fixture file is not found.
+* Instead of directly accessing the ``LogEntry.change_message`` attribute, it's
+ now better to call the ``LogEntry.get_change_message()`` method which will
+ provide the message in the current language.
+
.. _deprecated-features-1.10:
Features deprecated in 1.10