<s> from dajax . core import Dajax <EOL> from dajaxice . decorators import dajaxice_register <EOL> from django . template . loader import render_to_string <EOL> from dotastats . models import Heroes , SteamPlayer <EOL> @ dajaxice_register <EOL> def search_matches ( request , search_request ) : <EOL> if len ( search_request ) < <NUM_LIT:2> : <EOL> return None <EOL> dajax = Dajax ( ) <EOL> dajax . add_data ( "<STR_LIT>" , '<STR_LIT>' ) <EOL> return dajax . json ( ) <EOL> @ dajaxice_register <EOL> def search_players ( request , search_request ) : <EOL> if len ( search_request ) < <NUM_LIT:2> : <EOL> return None <EOL> dajax = Dajax ( ) <EOL> result_set = SteamPlayer . filter_by_name ( name = search_request , profileurl = search_request , communityid = search_request ) <EOL> result_string = render_to_string ( '<STR_LIT>' , dictionary = dict ( { '<STR_LIT>' : result_set } ) ) <EOL> dajax . add_data ( result_string , '<STR_LIT>' ) <EOL> return dajax . json ( ) <EOL> @ dajaxice_register <EOL> def search_heroes ( request , search_request ) : <EOL> if len ( search_request ) < <NUM_LIT:2> : <EOL> return None <EOL> dajax = Dajax ( ) <EOL> result_set = Heroes . objects . filter ( dota2_name__icontains = search_request ) [ : <NUM_LIT> ] <EOL> result_string = render_to_string ( '<STR_LIT>' , dictionary = dict ( { '<STR_LIT>' : result_set } ) ) <EOL> dajax . add_data ( result_string , '<STR_LIT>' ) <EOL> return dajax . json ( ) </s>
