Changes between Initial Version and Version 1 of Ticket #26780, comment 9
- Timestamp:
- Apr 20, 2018, 9:51:28 AM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #26780, comment 9
initial v1 3 3 from django.db.models import OuterRef, Subquery 4 4 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]))) 5 User.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])))