#NEWLINE# def _build_prefetch_queryset( self , name , original_field , field , filters , requirements ) : #NEWLINE# #INDENT# 'Applies prefetches to a queryset.' #NEWLINE# related_queryset = getattr ( original_field , 'queryset' , None ) #NEWLINE# if callable ( related_queryset ) : #NEWLINE# #INDENT# related_queryset = related_queryset ( field ) #NEWLINE# #UNINDENT# source = ( field . source or name ) #NEWLINE# required = requirements . pop ( source , None ) #NEWLINE# if self . DEBUG : #NEWLINE# #INDENT# prefetches = self . _prefetches #NEWLINE# self . _prefetches [ source ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . _prefetches = self . _prefetches [ original_field ] #NEWLINE# #UNINDENT# queryset = self . _filter_queryset ( serializer = field , filters = filters . get ( name , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) , queryset = related_queryset , requirements = required ) #NEWLINE# if self . DEBUG : #NEWLINE# #INDENT# self . _prefetches = prefetches #NEWLINE# #UNINDENT# return queryset