def new_user(): """Create a new user.""" form = NewUserForm() if form.is_submitted(): print("submitted") if form.validate_on_submit(): print("valid") print(form.errors) if form.validate_on_submit(): user = User(role=form.role.data, first_name=form.first_name.data, last_name=form.last_name.data, email=form.email.data, password=form.password.data, confirmed=True) db.session.add(user) db.session.commit() flash('User {} successfully created'.format(user.full_name()), 'form-success') return redirect(url_for('main.index')) return render_template('admin/new_user.html', form=form, is_volunteer=False)
def new_user(): """Create a new user.""" form = NewUserForm() if form.validate_on_submit(): user = User() form.populate_obj(user) db_session_add(user) flash('User {} successfully created'.format(user.full_name()), 'form-success') return render_template('admin/new_user.html', form=form)
def new_user(): """Create a new user.""" form = NewUserForm() if form.validate_on_submit(): user = User(username=form.username.data, name=form.name.data, role=form.role.data) user.set_password(form.password.data) db.session.add(user) db.session.commit() flash('User %s successfully created' % user.username, 'form-success') return render_template('admin/new_user.html', form=form)
def new_user(): """Create a new user.""" form = NewUserForm() if form.validate_on_submit(): user = User(first_name=form.first_name.data, last_name=form.last_name.data, email=form.email.data, password=form.password.data) db.session.add(user) db.session.commit() flash('User {} successfully created'.format(user.full_name()), 'success') return render_template('admin/new_user.html', form=form)
def new_user(): """Create a new user.""" form = NewUserForm() if form.validate_on_submit(): user = User( role=form.role.data, first_name=form.first_name.data, last_name=form.last_name.data, email=form.email.data, password=form.password.data, ) db.session.add(user) db.session.commit() flash("User {} successfully created".format(user.full_name()), "form-success") return render_template("admin/new_user.html", form=form)
def new_user(): """Create a new user.""" form = NewUserForm() if form.validate_on_submit(): user = User( role=form.role.data, user_name=form.user_name.data, full_name=form.full_name.data, email=form.email.data, password=form.password.data, confirmed=True ) db.session.add(user) db.session.commit() flash('User {} successfully created'.format(user.full_name), 'form-success') return render_template('admin/new_user.html', form=form)