Created
August 1, 2018 20:01
-
-
Save markddavidoff/df3171e05b7dfaac2b524cecdfeda4ed to your computer and use it in GitHub Desktop.
Find All most recent Historical Models objects for a Model tracked by simple history
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hists = HistoricalModel.objects.values('id').annotate(max_pk=Max('pk')).order_by() | |
most_recent_hist_model_for_model = dict(hists.values_list('id', 'max_pk')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment