コード例 #1
0
ファイル: game.py プロジェクト: Gegga87/DynamicGameDB
def search_relate_game(id):
    print "Connecting Games :D"
    if request.method == 'POST':
        print "POST"
        rel_search = request.form['relate_search_field']
        print rel_search
        game = dgdb.game(id)
        games = dgdb.games(search_term=rel_search)
        return render_template('relate_game.html',games=games, game=game, search=rel_search)
    else:
        game   = dgdb.game(id)
        games  = dgdb.game_relations(id)
        #TODO: connection mechanics
        return render_template('relate_game.html',games=games, game=game, search="GET")
コード例 #2
0
ファイル: game.py プロジェクト: Gegga87/DynamicGameDB
def edit_picture(id):

    game = dgdb.game(id)
    #platforms = dgdb.platforms()
    print "edit picture ****************************************"
    if request.method == 'POST':
        print "test"
        #try:
        print "try test"
        picture = request.files['picture']
        print "test moar"
        print "THIS FILE UPLOAD", picture
            # game = dgdb.edit_game(id, 
            #                   title=request.form['title'],
            #                   platform_id=request.form['platform'],
            #                   info=request.form['description'],
            #                   #picture=request.form['picture'],
            #                   release_date=request.form['release_date'],
            #                   developer=request.form['developer'],
            #                   publisher=request.form['publisher'])
        #except Exception, e:
            #flash(e.message)
        return redirect(url_for('frontend.game', id=game.id))
    else:
        date = datetime.utcnow()
        print date
        return render_template('edit_game.html',game=game, platforms=platforms)    
コード例 #3
0
def edit_picture(id):
    game = dgdb.game(id)
    #platforms = dgdb.platforms()
    print "edit picture ****************************************"
    if request.method == 'POST':
        print "test"
        #try:
        print "try test"
        picture = request.files['picture']
        print "test moar"
        print "THIS FILE UPLOAD", picture
        # game = dgdb.edit_game(id,
        #                   title=request.form['title'],
        #                   platform_id=request.form['platform'],
        #                   info=request.form['description'],
        #                   #picture=request.form['picture'],
        #                   release_date=request.form['release_date'],
        #                   developer=request.form['developer'],
        #                   publisher=request.form['publisher'])
        #except Exception, e:
        #flash(e.message)
        game = dgdb.edit_game_image(id, picture)
        print "Image sent from frontend view"
        return redirect(url_for('frontend.game', id=game.id))
    else:
        date = datetime.utcnow()
        print date
        return render_template('edit_game.html',
                               game=game,
                               platforms=platforms)
コード例 #4
0
def search_relate_game(id):
    print "Connecting Games :D"
    if request.method == 'POST':
        print "POST"
        rel_search = request.form['relate_search_field']
        print rel_search
        game = dgdb.game(id)
        games = dgdb.games(search_term=rel_search)
        return render_template('relate_game.html',
                               games=games,
                               game=game,
                               search=rel_search)
    else:
        game = dgdb.game(id)
        games = dgdb.game_relations(id)
        #TODO: connection mechanics
        return render_template('relate_game.html',
                               games=games,
                               game=game,
                               search="GET")
コード例 #5
0
ファイル: game.py プロジェクト: Gegga87/DynamicGameDB
def edit_game(id):
    game = dgdb.game(id)
    platforms = dgdb.platforms()
    print "edit game"
    if request.method == 'POST':
        try:
            game = dgdb.edit_game(id, 
                              title=request.form['title'],
                              platform_id=request.form['platform'],
                              info=request.form['description'],
                              #picture=request.form['picture'],
                              release_date=request.form['release_date'],
                              developer=request.form['developer'],
                              publisher=request.form['publisher'])
        except Exception, e:
            flash(e.message)
            return redirect(url_for('frontend.edit_game', id=id))
        print "after backend call"
        return redirect(url_for('frontend.game', id=game.id))
コード例 #6
0
def edit_game(id):
    game = dgdb.game(id)
    platforms = dgdb.platforms()
    print "edit game"
    if request.method == 'POST':
        try:
            game = dgdb.edit_game(
                id,
                title=request.form['title'],
                platform_id=request.form['platform'],
                info=request.form['description'],
                #picture=request.form['picture'],
                release_date=request.form['release_date'],
                developer=request.form['developer'],
                publisher=request.form['publisher'])
        except Exception, e:
            flash(e.message)
            return redirect(url_for('frontend.edit_game', id=id))
        print "after backend call"
        return redirect(url_for('frontend.game', id=game.id))
コード例 #7
0
ファイル: game.py プロジェクト: Gegga87/DynamicGameDB
def game(id):
    try:
        game = dgdb.game(id)
    except Exception, e:
        flash(e.message)
コード例 #8
0
def game(id):
    try:
        game = dgdb.game(id)
    except Exception, e:
        flash(e.message)