Ejemplo n.º 1
0
def get_platform(request, game_id):  
  if request.is_ajax(): 
    gb=giantbomb.Api('c815f273a0003ab1adf7284a4b2d61ce16d3d610')
    id=request.GET.get('id')
    results = s.getGameDetsById(game_id, 'platforms')
    platforms = results['platforms']
    results = []
    for platform in platforms:
      results.append(platform)
    message=json.dumps(results)
    return HttpResponse(message)
Ejemplo n.º 2
0
def game_details(request, game_id):
  # Is the game in wishlist?
  in_wishlist = False
  if request.user.is_authenticated():
    try:
      wish_game = Game.objects.get(giant_bomb_id = game_id, platform = '')
      if Wishlist.objects.filter(user = request.user.get_profile(), wishlist_game = wish_game):
        in_wishlist = True
    except Game.DoesNotExist:
      pass

  game = s.getGameDetsById(game_id, 'id','name', 'original_release_date', 'image', 'deck', 'genres', 'platforms', 'site_detail_url')
  try:
      platforms_listed = Game.objects.filter(giant_bomb_id = game_id).exclude(num_of_listings = 0).values_list('platform')
      platforms_count = {}
      if platforms_listed:
        for k in platforms_listed:
          v = Game.objects.get(giant_bomb_id = game_id, platform = k[0]).num_of_listings
          platforms_count[k[0]] = v
  except Currentlist.DoesNotExist:
      games_listed = 0
  return render(request,'game_page.html', {'game': game, 'listings': platforms_count, 'in_wishlist': in_wishlist,})
Ejemplo n.º 3
0
def put_in_game_table(id, platform):
  game = s.getGameDetsById(id, 'platforms', 'image', 'name', 'id')
  game = Game.objects.create(platform = platform, image_url = game['image'], \
    name = game['name'], num_of_listings = 0, giant_bomb_id = game['id'])
  game.save()
  return game
Ejemplo n.º 4
0
import search as s
print 'Testing search on just name'
print s.getList('assassin', 'name') 
print '\n'
game = s.getList('halo', 'name', 'id') 
print '\n'
print s.getList('halo', 'name', 'id')
print '\n'
id = game['Halo Wars']['id']
print game.keys()
print 'accessing the search result \'Halo Zero\' to get id=' + id 
print '\n'
print 'Using Id to test get game details'
print s.getGameDetsById(id, 'name', 'id', 'original_release_date', 'deck' )
id = '123215431464257'
print s.getGameDetsById(id, 'name', 'id', 'original_release_date', 'deck' )