コード例 #1
0
def create():
    errors = User.validate(request.form)
    if errors:
        for error in errors:
            flash(error)
        return redirect(url_for('users:login_and_registration'))
    user_id = User.create(request.form)
    session['user_id'] = user_id
    return redirect(url_for("dashboard"))
コード例 #2
0
def editing(user_id):
    user = User.query.get(user_id)
    errors = User.validate(request.form)
    if errors:
        for error in errors:
                flash(error)
        return redirect(url_for('users:edit'))
    user.first_name = request.form['first_name']
    user.last_name = request.form['last_name']
    user.email = request.form['email']
    db.session.commit()
    return redirect(url_for('dashboard'))
コード例 #3
0
def create():
    # @A1aaaaa
    alerts = User.validate(request.form)
    if len(alerts) > 0:
        print(len(alerts))
        if len(alerts) == 5:
            print(len(alerts))
            flash('All fields are required!')
            return redirect('/portfolio/user/register')
        else:
            print(len(alerts))
            for alert in alerts:
                flash(alert)
            return redirect('/portfolio/user/register')
    else:
        User.create(request.form)
        return redirect('/portfolio/user/thankyou')
コード例 #4
0
def create():
    # @A1aaaaa
    alerts = User.validate(request.form)
    if len(alerts) > 0:
        print(alerts)
        if len(alerts) == 10:
            flash('All fields are required!')
            # return redirect('/user/register')
            return render_template('/partials/alerts.html'), 500   
        else:
            for alert in alerts:
                flash(alert)
            # return redirect('/user/register') 
            return render_template('/partials/alerts.html'), 500
    else:
        user_id = User.create(request.form)
        session['user_id'] = user_id
        return redirect('/user/thankyou')