I am setting historical record for some of my models. It works, the table is created and behaves as expected, however, I can not get it to appear in my admin tables.
models.py
class Test(models.Model):
...
history = HistoricalRecords()
In admin.py I have a TestAdmin(admin.ModelAdmin) such as:
class TestAdmin(admin.ModelAdmin):
list_display = ('test', 'id')
list_filter = ['test']
admin.site.register(Test, TestAdmin) #1
# admin.site.register(Test, SimpleHistoryAdmin) #2
When I use the #1 line I have everything working well except that I don't have the historical table. When I use the #2 line I don't get it neither and my format doesn't work anymore. When I set both I get an error django.contrib.admin.sites.AlreadyRegistered: The model Test is already registered with 'test.TestAdmin' (that makes sens).
What am I missing to get the historical record table appears in my admin?
Thanks for your time.
You should subclass the
SimpleHistoryAdminas is specified in the Displaying custom columns in the admin history list view section of the documentation: