Esempio n. 1
0
File: views.py Progetto: uve/onarena
def player_edit(request,player_id=None,  format='html'):


    team_id = request.REQUEST.get('team_id', '')
    if team_id:
        team = api.team_get(team_id = team_id)
        player = api.player_get(player_id = player_id, team_id = team_id)
    else:
        player = api.player_get(player_id = player_id)
        team_id = None
                
                        
    if not player:
        return http.HttpResponse()
      
    logging.info("player: %s", player)    
    #logging.info("player: %s", player["tournament_id"]["sport_id"]["id"])


    if not request.is_owner:
        return http.HttpResponseRedirect("/player/" + player_id + "/")        


    all_positions = api.positions_browse(sport_id = player["tournament_id"]["sport_id"]["id"])    
    
    if request.POST and request.is_owner:
        item = api.player_edit(request = request, player_id = player_id)
            
        return http.HttpResponseRedirect("/player/" + player_id + "/")


    area = 'player'
    
    if format == 'html':
        return api.response_get(request, locals(), 'player/templates/edit.html')     
Esempio n. 2
0
File: views.py Progetto: uve/onarena
def player_item(request, player_id = None, format='html'):

    player = api.player_get(player_id = player_id)
    
    team_id = request.REQUEST.get('team_id', '')
    
    if not player:
        return http.HttpResponse()
            
    player_stat = api.player_stat_get(player_id = player_id)
    
    area = 'player'

    if format == 'html':
        return api.response_get(request, locals(), 'player/templates/item.html')