#NEWLINE# def get( self , request , * args , **kwargs ) : #NEWLINE# #INDENT# term = request . GET . get ( 'term' , '' ) #NEWLINE# app = request . GET . get ( 'app_id' , '' ) #NEWLINE# if ( not term . startswith ( '{' ) ) : #NEWLINE# #INDENT# term = ( '{' + term ) #NEWLINE# #UNINDENT# term = term . upper ( ) #NEWLINE# requests = Request . objects . filter ( apprequest__appid = app , userid__startswith = term ) #NEWLINE# requests = requests . distinct ( 'userid' ) . values_list ( 'userid' , flat = True ) [ : self . max_results ] #NEWLINE# return JsonResponse ( { #NEWLINE# #INDENT# 'results' : [ { #NEWLINE# #INDENT# 'text' : userid , #NEWLINE# 'id' : userid , #NEWLINE# #UNINDENT# } for userid in requests ] , #NEWLINE# 'more' : False , #NEWLINE# #UNINDENT# } )