1👍
This should work,
Book.objects.order_by('-id')[3:]
if you want to get them in order
Book.objects.order_by('-id')[3:][::-1]
0👍
As you have
books = Book.objects.order_by('-id')[:3]
list_to_exclude = [b.id for b in books]
and then
books_excl = Book.objects.all().exclude(id__in=list_to_exclude)
- How to extend Django CMS template?
- How to get an element from list based on clicked link in Django Template?
- HTML/JS/Django Hiding incompatible options from two picklists
0👍
Use:
Book.objects.exclude(pk__in=Book.objects.order_by('-id')[:3])
Note: above query tested on postgres 9.5.3
Source:stackexchange.com