Exemple #1
0
def roles_create():
    form = RoleForm(request.form)

    if not form.validate():
        return render_template("roles/list.html",
                               roles=Role.get_role_list(),
                               form=form)

    role = Role(form.name.data)
    try:
        db.session.add(role)
        db.session.commit()
    except IntegrityError:
        db.session.rollback()
        return render_template("roles/list.html",
                               roles=Role.get_role_list(),
                               form=form,
                               Roles_name_taken=True)
    return render_template("roles/list.html",
                           roles=Role.get_role_list(),
                           form=form)
Exemple #2
0
def roles_index():
    form = RoleForm()
    return render_template("roles/list.html",
                           roles=Role.get_role_list(),
                           form=form)