File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ Authors
36
36
- vnagendra
37
37
- Lucas Wiman
38
38
- Michael England
39
+ - Gregory Bataille
39
40
40
41
Background
41
42
==========
Original file line number Diff line number Diff line change 4
4
tip (unreleased)
5
5
----------------
6
6
- Added --batchsize option to the populate_history management command.
7
+ - Add the ability to display object attributes in the history list view to see
8
+ what has changed easily
7
9
8
10
1.8.2 (2017-01-19)
9
11
------------------
Original file line number Diff line number Diff line change @@ -127,6 +127,36 @@ An example of admin integration for the ``Poll`` and ``Choice`` models:
127
127
Changing a history-tracked model from the admin interface will automatically record the user who made the change (see :doc: `/advanced `).
128
128
129
129
130
+ Displaying custom columns in the admin history list view
131
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132
+
133
+ By default, the history log displays one line per change containing
134
+
135
+ * a link to the detail of the object at that point in time
136
+ * the date and time the object was changed
137
+ * a comment corresponding to the change
138
+ * the author of the change
139
+
140
+ You can add other columns (for example the object's status if it has one to see
141
+ how it evolved) by adding a ``history_list_display `` array of fields to the
142
+ admin class
143
+
144
+ .. code-block :: python
145
+
146
+ from django.contrib import admin
147
+ from simple_history.admin import SimpleHistoryAdmin
148
+ from .models import Poll, Choice
149
+
150
+
151
+ class PollHistoryAdmin (SimpleHistoryAdmin ):
152
+ list_display = [" id" , " name" , " status" ]
153
+ history_list_display = [" status" ]
154
+ search_fields = [' name' , ' user__username' ]
155
+
156
+ admin.site.register(Poll, PollHistoryAdmin)
157
+ admin.site.register(Choice, SimpleHistoryAdmin)
158
+
159
+
130
160
Querying history
131
161
----------------
132
162
You can’t perform that action at this time.
0 commit comments