def add_privilege(): form = NewPrivilegeForm(request.form, obj=current_user) if request.method == 'POST' and form.validate(): for role in db.session.query(Role).order_by(Role.name): if role.name == form.name.data: flash( word( 'The privilege could not be added because it already exists.' ), 'error') return redirect(url_for('privilege_list')) db.session.add(Role(name=form.name.data)) db.session.commit() #docassemble.webapp.daredis.clear_user_cache() flash(word('The privilege was added.'), 'success') return redirect(url_for('privilege_list')) response = make_response( render_template('users/new_role_page.html', version_warning=None, bodyclass='daadminbody', page_title=word('Add Privilege'), tab_title=word('Add Privilege'), form=form), 200) response.headers[ 'Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0' return response
def add_privilege(): form = NewPrivilegeForm(request.form, current_user) if request.method == 'POST' and form.validate(): for role in db.session.query(Role).order_by(Role.name): if role.name == form.name.data: flash(word('The privilege could not be added because it already exists.'), 'error') return redirect(url_for('privilege_list')) db.session.add(Role(name=form.name.data)) db.session.commit() flash(word('The privilege was added.'), 'success') return redirect(url_for('privilege_list')) return render_template('users/new_role_page.html', form=form)
def add_privilege(): form = NewPrivilegeForm(request.form, obj=current_user) if request.method == 'POST' and form.validate(): for role in db.session.query(Role).order_by(Role.name): if role.name == form.name.data: flash(word('The privilege could not be added because it already exists.'), 'error') return redirect(url_for('privilege_list')) db.session.add(Role(name=form.name.data)) db.session.commit() flash(word('The privilege was added.'), 'success') return redirect(url_for('privilege_list')) return render_template('users/new_role_page.html', version_warning=None, bodyclass='adminbody', page_title=word('Add Privilege'), tab_title=word('Add Privilege'), form=form)
def add_privilege(): form = NewPrivilegeForm(request.form, current_user) if request.method == "POST" and form.validate(): for role in db.session.query(Role).order_by(Role.name): if role.name == form.name.data: flash(word("The privilege could not be added because it already exists."), "error") return redirect(url_for("privilege_list")) db.session.add(Role(name=form.name.data)) db.session.commit() flash(word("The privilege was added."), "success") return redirect(url_for("privilege_list")) return render_template("users/new_role_page.html", form=form)
def add_privilege(): form = NewPrivilegeForm(request.form, obj=current_user) if request.method == 'POST' and form.validate(): for role in db.session.query(Role).order_by(Role.name): if role.name == form.name.data: flash(word('The privilege could not be added because it already exists.'), 'error') return redirect(url_for('privilege_list')) db.session.add(Role(name=form.name.data)) db.session.commit() #docassemble.webapp.daredis.clear_user_cache() flash(word('The privilege was added.'), 'success') return redirect(url_for('privilege_list')) return render_template('users/new_role_page.html', version_warning=None, bodyclass='adminbody', page_title=word('Add Privilege'), tab_title=word('Add Privilege'), form=form)