Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class IndexListView(ListView):
- model = Post
- template_name = 'blog/index.html'
- queryset = Post.objects.prefetch_related(
- 'comments'
- ).select_related('author').filter(
- pub_date__lt=tz.now(),
- is_published=True,
- category__is_published=True,
- ).annotate(comment_count=Count('comments'))
- ordering = '-pub_date'
- paginate_by = NUM_PAGES
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement