1👍
The reason this happens is because you filter in the template, so after the queryset is paginated. Filtering in the template is not a good idea, for example because it will render the pagination incorrect, but it is also inefficent.
You should filter in the view, with:
class VideoListView(generic.ListView):
model = Video
queryset = Video.objects.filter(home=True).order_by('-date')
template_name = 'index.html'
context_object_name = 'video_list'
paginate_by = 10
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['category_list'] = Category.objects.all()
return context
and thus remove the {% if video.home == True %} … {% endif %}
part.
Source:stackexchange.com