コード例 #1
0
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))
コード例 #2
0
ファイル: routes.py プロジェクト: RogueNPC/BEW-1.2-Auth-Work
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)
コード例 #3
0
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)
コード例 #4
0
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)
コード例 #5
0
def add_to_shopping_list(item_id):

    item = User(item=item_id)
    db.session.add(item)
    db.session.commit(item)