'How to use paginate_orphans in django function based views?

In Class-Based View We Can Use Like This.

class PostListView(ListView):
    model = Post
    template_name ='blog/index.html'
    ordering = ['id']
    paginate_by = 5
    paginate_orphans = 2

But How can I Use this paginate_orphans in function-based views?

page = request.GET.get('page', 1)
paginator = Paginator(filter_qs, 2)
try:
   filter_qs = paginator.page(page)
except PageNotAnInteger:
   filter_qs = paginator.page(1)
except EmptyPage:
   filter_qs = paginator.page(paginator.num_pages)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source