Changes between Initial Version and Version 1 of Ticket #26780, comment 9


Ignore:
Timestamp:
Apr 20, 2018, 9:51:28 AM (6 years ago)
Author:
Haseeb Ahmad

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26780, comment 9

    initial v1  
    33from django.db.models import OuterRef, Subquery
    44
    5 User.objects.all().prefetch_related('comments', queryset=Comment.objects.filter(id__in=Subquery(
    6 Comment.objects.filter(user_id=OuterRef('user_id')).values_list('id', flat=True)[:5])))
     5User.objects.all().prefetch_related('comments',queryset=Comment.objects.filter(id__in=Subquery(Comment.objects.filter(user_id=OuterRef('user_id')).values_list('id', flat=True)[:5])))
Back to Top