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')
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')
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)