Advertisement
Guest User

Views.py

a guest
Jan 30th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. @application.route('/get_search_results',methods=["GET"])
  2. def get_search_results():
  3.  
  4.     search_query = request.args.get('search_query')
  5.     player_list = search_database(search_query)
  6.  
  7.     return_json = []
  8.     for player in player_list:
  9.         dictionary = { 'title' : player.full_name(),
  10.                        'link' : 'player='+str(player.identifier),
  11.                        'logo' : player.team_logo() }
  12.         return_json.append(dictionary)
  13.  
  14.     return jsonify(search_results=return_json)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement