Home:ALL Converter>How to get the last changed object in django-simple-history?

How to get the last changed object in django-simple-history?

Ask Time:2017-04-12T16:38:55         Author:Daniel

Json Formatter

Using django-simple-history, how can I get the last changed object from my model?

I tried MyModel.history.most_recent(), which needs a model instance, so that returns probably the most recent version of a selected instance.

I can query Abonnent.history.all(), which obviously returns a list of all versions of all model objects. This looks good, but how can I filter out the most recent and get the date of the last change?

Author:Daniel,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/43364451/how-to-get-the-last-changed-object-in-django-simple-history
Artur Bersan :

If MyModel.history is a HistoricalRecords objects you access like: \nMyModel.history.last()",
2017-12-21T14:55:52
yy