[Answer]-Second to last item in django-simple-history

1👍

As history all looks like a list:

model.history.all()[:-3]

Should get the last 3 but it looks like it uses an iterator that doesn’t support negative indexes. You could possibly use something like:

last3 = []
for h in model.history.all:
   if len(last3) > 2:
       del last3[0]
   last3.append[h]

but you might wish to seect by date to limit changes to recent.

Leave a comment