def showProducts(): output = [] for p in db_find_all(products): output.append({ 'name': p['name'], 'price': p['price'], 'quantity': p['quantity'] }) return jsonify({'Products': output})
def login1(): form = LoginForm(request.form) login_error = False if len(form.errors): print(form.errors) if request.method == 'POST': if form.username.data == 'admin' and form.password.data == 'admin': registered = db_find_all(users) return render_template('tables.html', users=registered) else: login_error = True return render_template('login.html', login_error=login_error)
def login(): form = BuyForm(request.form) login_error = False if request.method == 'POST': item = form.item.data precio = form.precio.data if item != '' and precio != '': user = {"item": item, "precio": precio} db_insert_user(users, user) registro = db_find_all(users) flag = True return render_template('index.html', users=registro) return render_template('index.html', login_error=login_error, users=registro)
def tabla(): registered = db_find_all(voluntariados) return render_template('/tabla.html', voluntariados=registered)