#NEWLINE# def get( self , request ) : #NEWLINE# #INDENT# params = self . get_params ( request ) #NEWLINE# queryset = self . get_queryset ( request , params ) #NEWLINE# if ( params [ 'query' ] and OPTIONAL_DEPS [ 'haystack' ] ) : #NEWLINE# #INDENT# usage . log ( 'search' , model = self . model , request = request , data = { #NEWLINE# #INDENT# 'query' : params [ 'query' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# results = self . model . objects . search ( params [ 'query' ] , queryset = queryset , max_results = params [ 'limit' ] , partial = True ) #NEWLINE# objects = ( x . object for x in results ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( params [ 'sort' ] == 'name' ) : #NEWLINE# #INDENT# order = ( '-name' if ( params [ 'order' ] == 'desc' ) else 'name' ) #NEWLINE# queryset = queryset . order_by ( order ) #NEWLINE# #UNINDENT# if params [ 'limit' ] : #NEWLINE# #INDENT# queryset = queryset [ : params [ 'limit' ] ] #NEWLINE# #UNINDENT# objects = queryset #NEWLINE# #UNINDENT# if self . checks_for_orphans : #NEWLINE# #INDENT# pks = [ ] #NEWLINE# for obj in objects : #NEWLINE# #INDENT# if ( not is_field_orphaned ( obj ) ) : #NEWLINE# #INDENT# pks . append ( pks . pk ) #NEWLINE# #UNINDENT# #UNINDENT# objects = self . model . objects . filter ( pk__in = pks ) #NEWLINE# #UNINDENT# return self . prepare ( request , objects , ** params )