Reputation: 63
i have two rendered contexts in my view:
def PostHomeView(request):
RecentPost = Post.objects.order_by("-date").all()[:5]
AllOtherPosts = Post.objects.order_by("-date").all()
template_name = 'lista_post.html'
context = {**strong text**
'recentposts' : RecentPost,
'allposts' : AllOtherPosts
}
return render(request,template_name,context)
in the second one ('allposts') i would like to get all objcects without the first fve how can i do it?
Upvotes: 1
Views: 24
Reputation: 88539
Use slicing as AllOtherPosts = Post.objects.order_by("-date").all()[5:]
Upvotes: 1