def user_create(): form = UserForm() if form.validate_on_submit(): current_app.logger.info("USER CREATED with email {}".format(form.email.data)) User.create(email=form.email.data, full_name=form.full_name.data, role_id=form.role_id.data) flash("Created a new profile.", "alert-success") return redirect(url_for("user.user_manage")) else: return render_template( "user/add-edit.html", form=form, date=today.strftime("%B %d, %Y"), form_action=url_for("user.user_create"), title="Add User", action="Add User", )
def user_create(): form = UserForm() if form.validate_on_submit(): current_app.logger.info('USER CREATED with email {}'.format( form.email.data)) User.create(email=form.email.data, full_name=form.full_name.data, role_id=form.role_id.data) flash('Created a new profile.', 'alert-success') return redirect(url_for('user.user_manage')) else: return render_template('user/add-edit.html', form=form, date=today.strftime('%B %d, %Y'), form_action=url_for('user.user_create'), title='Add User', action='Add User')
def user_edit(id): user = get_object_or_404(User, User.id == id) form = UserForm(obj=user) if form.validate_on_submit(): user.update(full_name=form.full_name.data, email=form.email.data, role_id=form.role_id.data) flash("Profile changes saved.", "alert-success") current_app.logger.info("url_for of user.user_mange is: {}".format(url_for("user.user_manage"))) return redirect(url_for("user.user_manage")) else: return render_template( "user/add-edit.html", form=form, date=today.strftime("%B %d, %Y"), form_action=url_for("user.user_edit", id=id), title="Edit User", action="Save Changes", )
def user_edit(id): user = get_object_or_404(User, User.id == id) form = UserForm(obj=user) if form.validate_on_submit(): user.update(full_name=form.full_name.data, email=form.email.data, role_id=form.role_id.data) flash('Profile changes saved.', 'alert-success') current_app.logger.info('url_for of user.user_mange is: {}'.format( url_for('user.user_manage'))) return redirect(url_for('user.user_manage')) else: return render_template('user/add-edit.html', form=form, date=today.strftime('%B %d, %Y'), form_action=url_for('user.user_edit', id=id), title='Edit User', action='Save Changes')
def user_create(): form = UserForm() if form.validate_on_submit(): current_app.logger.info( 'USER CREATED with email {}'.format(form.email.data) ) User.create( email=form.email.data, full_name=form.full_name.data, role_id=form.role_id.data) flash('Created a new profile.', 'alert-success') return redirect(url_for('user.user_manage')) else: return render_template( 'user/add-edit.html', form=form, date=today.strftime('%B %d, %Y'), form_action=url_for('user.user_create'), title='Add User', action='Add User')
def user_edit(id): user = get_object_or_404(User, User.id == id) form = UserForm(obj=user) if form.validate_on_submit(): user.update( full_name=form.full_name.data, email=form.email.data, role_id=form.role_id.data ) flash('Profile changes saved.', 'alert-success') current_app.logger.info( 'url_for of user.user_mange is: {}'.format(url_for('user.user_manage'))) return redirect(url_for('user.user_manage')) else: return render_template( 'user/add-edit.html', form=form, date=today.strftime('%B %d, %Y'), form_action=url_for('user.user_edit', id=id), title='Edit User', action='Save Changes')
def set_form(): form = UserForm() users = User.query.order_by(User.role_id).all() stakeholders = Stakeholder.query.order_by(Stakeholder.id).all() monthly_admins = Monthly.query.first() return render_template("user/manage.html", current_user=current_user, users=users, date=today.strftime('%B %d, %Y'), routes=PERMIT_TYPE, form=form, stakeholders=stakeholders, monthly=monthly_admins, title='Manage Users')