Exemple #1
0
def feature(mod_id):
    mod = Mod.query.filter(Mod.id == mod_id).first()
    if not mod:
        abort(404)
    game = Game.query.filter(Game.id == mod.game_id).first()
    session['game'] = game.id
    session['gamename'] = game.name
    session['gameshort'] = game.short
    session['gameid'] = game.id
    if not mod or not game:
        ga = Game.query.filter(Game.short == 'kerbal-space-program').order_by(
            desc(Game.id)).first()
        session['game'] = ga.id
        session['gamename'] = ga.name
        session['gameshort'] = ga.short
        session['gameid'] = ga.id
        abort(404)
    else:
        session['game'] = game.id
        session['gamename'] = game.name
        session['gameshort'] = game.short
        session['gameid'] = game.id
    if any(Featured.query.filter(Featured.mod_id == mod_id).all()):
        abort(409)
    feature = Featured()
    feature.mod = mod
    db.add(feature)
    return {"success": True}
Exemple #2
0
def feature(mod_id):
    mod = Mod.query.filter(Mod.id == mod_id).first()
    if not mod:
        abort(404)
    game = Game.query.filter(Game.id == mod.game_id).first()
    session['game'] = game.id;
    session['gamename'] = game.name;
    session['gameshort'] = game.short;
    session['gameid'] = game.id;
    if not mod or not game:
        ga = Game.query.filter(Game.short == 'kerbal-space-program').order_by(desc(Game.id)).first()
        session['game'] = ga.id;
        session['gamename'] = ga.name;
        session['gameshort'] = ga.short;
        session['gameid'] = ga.id;
        abort(404)
    else:
        session['game'] = game.id;
        session['gamename'] = game.name;
        session['gameshort'] = game.short;
        session['gameid'] = game.id;
    if any(Featured.query.filter(Featured.mod_id == mod_id).all()):
        abort(409)
    feature = Featured()
    feature.mod = mod
    db.add(feature)
    return { "success": True }
Exemple #3
0
def feature(mod_id):
    mod = Mod.query.filter(Mod.id == mod_id).first()
    if not mod:
        abort(404)
    if any(Featured.query.filter(Featured.mod_id == mod_id).all()):
        abort(409)
    feature = Featured()
    feature.mod = mod
    db.add(feature)
    return { "success": True }
Exemple #4
0
def feature(mod_id):
    mod = Mod.query.filter(Mod.id == mod_id).first()
    if not mod:
        abort(404)
    if any(Featured.query.filter(Featured.mod_id == mod_id).all()):
        abort(409)
    feature = Featured()
    feature.mod = mod
    db.add(feature)
    return { "success": True }