示例#1
0
def builder_create():
    if not current_user.is_authenticated:
        return redirect(url_for('login'))
    form = BuilderForm()
    if form.validate_on_submit():
        success, msg = create_records(Builder, form)
        flash(msg)
        if success:
            return redirect(url_for('builder_view'))
    return render_template('multiform.html',
                           form=form,
                           model_name='builder',
                           operation='Create')
示例#2
0
def ship_create():
    if not current_user.is_authenticated:
        return redirect(url_for('login'))
    form = ShipForm()
    print(form.__dict__)
    if form.validate_on_submit():
        success, msg = create_records(Ship, form)
        flash(msg)
        if success:
            return redirect(url_for('ship_view'))
    return render_template('multiform.html',
                           form=form,
                           model_name='ship',
                           operation='Create')
示例#3
0
def users_create():
    if current_user.is_authenticated and current_user.is_admin:
        form = UserForm()
        if form.validate_on_submit():
            success, msg = create_records(User, form)
            flash(msg)
            if success:
                return redirect(url_for('users_view'))
        return render_template('multiform.html',
                               form=form,
                               model_name='users',
                               operation='Create')
    else:
        return abort(403)