class Popular(generic.ListView):
template_name = 'posts/popular.html'
context_object_name = 'posts_list'
def get_queryset(self):
return Post.objects.filter(date_add__lte = timezone.now()).order_by('-date_add')
class ClassNameForPage(generic.ListView):
...
def get_queryset(self):
Post.objects.filter(date_add__lte = timezone.now(), like__gte = 5).order_by('-date_add')