def add_to_shopping_list(item_id): item = GroceryItem.query.get(item_id) shopping_list = User(shopping_list_items=item) db.session.add(shopping_list) db.session.commit() flash('successful') return redirect(url_for('main.store_detail', item_id=item.id))
def signup(): form = SignUpForm() if form.validate_on_submit(): hashed_password = bcrypt.generate_password_hash(form.password.data).decode('utf-8') user = User( username=form.username.data, password=hashed_password ) db.session.add(user) db.session.commit() flash('Account Created.') return redirect(url_for('main.login')) return render_template('signup.html', form=form)
def signup(): print('in signup') form = SignUpForm() if form.validate_on_submit(): hashed_password = bcrypt.generate_password_hash( form.password.data).decode('utf-8') user = User(username=form.username.data, password=hashed_password) db.session.add(user) db.session.commit() flash('Account Created.') print('created') return redirect(url_for('auth.login')) print(form.errors) return render_template('signup.html', form=form, current_user=current_user)
def signup(): print("in signup") form = SignUpForm() if form.validate_on_submit(): hashed_password = bcrypt.generate_password_hash(form.password.data).decode( "utf-8" ) user = User(username=form.username.data, password=hashed_password) db.session.add(user) db.session.commit() flash("Account Created.") print("created") return redirect(url_for("auth.login")) print(form.errors) return render_template("signup.html", form=form)
def add_to_shopping_list(item_id): item = User(item=item_id) db.session.add(item) db.session.commit(item)