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
3636- vnagendra
3737- Lucas Wiman
3838- Michael England
39+ - Gregory Bataille
3940
4041Background
4142==========
Original file line number Diff line number Diff line change 44tip (unreleased)
55----------------
66- 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
79
8101.8.2 (2017-01-19)
911------------------
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:
127127 Changing a history-tracked model from the admin interface will automatically record the user who made the change (see :doc: `/advanced `).
128128
129129
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+
130160 Querying history
131161----------------
132162
You can’t perform that action at this time.
0 commit comments