Пример #1
0
def engine_update(rec_id: int = None):
    if not current_user.is_authenticated:
        return redirect(url_for('login'))
    engine = Engine.query.get(rec_id)
    if not engine:
        abort(404)
    form = EngineForm(obj=engine)
    if form.validate_on_submit():
        status, msg = update_records(engine, form)
        flash(msg)
        return redirect(url_for('engine_view'))
    return render_template('multiform.html',
                           form=form,
                           model_name='engine',
                           operation='Update')
Пример #2
0
def ship_update(rec_id: int = None):
    if not current_user.is_authenticated:
        return redirect(url_for('login'))
    ship = Ship.query.get(rec_id)
    if not ship:
        abort(404)
    form = ShipForm(obj=ship)
    print(form.__dict__)
    if form.validate_on_submit():
        status, msg = update_records(ship, form)
        flash(msg)
        return redirect(url_for('ship_view'))
    return render_template('multiform.html',
                           form=form,
                           model_name='ship',
                           operation='Update')
Пример #3
0
def builder_update(rec_id: int = None):
    if not current_user.is_authenticated:
        return redirect(url_for('login'))
    builder = Builder.query.get(rec_id)
    if not builder:
        abort(404)
    form = BuilderForm(obj=builder)
    print(form.__dict__)
    if form.validate_on_submit():
        status, msg = update_records(builder, form)
        flash(msg)
        return redirect(url_for('builder_view'))
    return render_template('multiform.html',
                           form=form,
                           model_name='builder',
                           operation='Update')