Esempio n. 1
0
def bookadd_post():
    f = bookadd_form(grades, groups)
    if not f.validates():
        return render.bookadd(f)
    else:
        config.DB.insert('books', titulo=f.d.titulo, curso=f.d.curso, grupo=f.d.grupo, editorial=f.d.editorial, isbn=f.d.isbn, precio=f.d.precio, stock=f.d.stock)
        raise web.seeother('/admin/books')
Esempio n. 2
0
def bookadd_get():
    grades = []
    db_grades = config.DB.select('grades')
    for grade in db_grades:
        grades.append((grade.grade, grade.grade))

    groups = []
    db_groups = config.DB.select('groups')
    for group in db_groups:
        groups.append((group.groupe, group.groupe))
    f = bookadd_form(grades, groups)
    return render.bookadd(f)