Esempio n. 1
0
def any_auction(auction_id):
    if request.method == 'GET':
        auction_info = api.get_info_auction(auction_id)
        is_self = True
        if str(auction_info[0]) == str(session['user_logged_in']):
            is_self = False
        username_a = auction_info[0]
        bids = api.get_bids(auction_id)
        locations = api.get_location_list();
        image = api.get_user_image(session['user_logged_in'])
        image_map = api.user_image_map()
        winner = api.get_winner(auction_id)

        timeleft = api.time_dif(auction_info)
        api.check_current_auctions()
        print(winner)
        return render_template('any_auction.html',username_a=username_a,
            username=session['user_logged_in'],
            order=auction_info[1],location=auction_info[5],aid=auction_id,
            bids=bids,is_self=is_self,locations=locations,
            image=image,image_map=image_map, time_left=timeleft,
            winner=winner)
    
    location = request.form['location']
    price = request.form['price']
    cur_id = session['user_logged_in']
    api.add_bid_to_auction(auction_id,cur_id,price,location)

    return redirect(url_for('any_auction',auction_id=auction_id))
Esempio n. 2
0
def my_account():
    username = session['user_logged_in']
    op,closed = api.get_my_auctions(username)
    winner_for_close = {}
    for close in closed:
        winner_for_close[close[0]] = api.get_winner(close[0])
    bids = []
    image = api.get_user_image(session['user_logged_in'])
    return render_template('myaccount.html',op=op,closed=closed,bids=bids,
        winner_map=winner_for_close,image=image)