summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAlex Morozov <morozov@podmoskovie.info>2015-11-02 12:59:22 +0300
committerTim Graham <timograham@gmail.com>2015-11-05 10:20:34 +0100
commita31973c7c519234a07c1ec779fbc0bb424bcc702 (patch)
tree186955968ca654be977b0061f5835ef034959733 /docs
parente86b5a5aab4d322ad1c4e12a8eec1bab8338b6d5 (diff)
[1.8.x] Fixed #24244 -- Documented contrib.admin.models.LogEntry
Backport of 99c58c27d5a8e4a66230c413380508af223d12a8 from master
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/admin/index.txt59
-rw-r--r--docs/ref/databases.txt2
2 files changed, 60 insertions, 1 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 86562290f5..c1475babc7 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -2720,6 +2720,65 @@ The presence of the ``admin_password_reset`` named URL will cause a "forgotten
your password?" link to appear on the default admin log-in page under the
password box.
+``LogEntry`` objects
+====================
+
+.. class:: models.LogEntry
+
+ The ``LogEntry`` class tracks additions, changes, and deletions of objects
+ done through the admin interface.
+
+.. currentmodule:: django.contrib.admin.models
+
+``LogEntry`` attributes
+-----------------------
+
+.. attribute:: LogEntry.action_time
+
+ The date and time of the action.
+
+.. attribute:: LogEntry.user
+
+ The user (an :setting:`AUTH_USER_MODEL` instance) who performed the
+ action.
+
+.. attribute:: LogEntry.content_type
+
+ The :class:`~django.contrib.contenttypes.models.ContentType` of the
+ modified object.
+
+.. attribute:: LogEntry.object_id
+
+ The textual representation of the modified object's primary key.
+
+.. attribute:: LogEntry.object_repr
+
+ The object`s ``repr()`` after the modification.
+
+.. attribute:: LogEntry.action_flag
+
+ The type of action logged: ``ADDITION``, ``CHANGE``, ``DELETION``.
+
+ For example, to get a list of all additions done through the admin::
+
+ from django.contrib.admin.models import LogEntry, ADDITION
+
+ LogEntry.objects.filter(action_flag=ADDITION)
+
+.. 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.
+
+``LogEntry`` methods
+--------------------
+
+.. method:: LogEntry.get_edited_object()
+
+ A shortcut that returns the referenced object.
+
+.. currentmodule:: django.contrib.admin
+
.. _admin-reverse-urls:
Reversing admin URLs
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
index e5874311de..0dfacbeb02 100644
--- a/docs/ref/databases.txt
+++ b/docs/ref/databases.txt
@@ -366,7 +366,7 @@ Should you decide to use ``utf8_bin`` collation for some of your tables with
MySQLdb 1.2.1p2 or 1.2.2, you should still use ``utf8_general_ci``
(the default) collation for the ``django.contrib.sessions.models.Session``
table (usually called ``django_session``) and the
-``django.contrib.admin.models.LogEntry`` table (usually called
+:class:`django.contrib.admin.models.LogEntry` table (usually called
``django_admin_log``). Those are the two standard tables that use
:class:`~django.db.models.TextField` internally.