def studadd_post(): f = studadd_form(grades, groups) if not f.validates(): return render.studadd(f) else: config.DB.insert('students', nombre=f.d.nombre, curso=f.d.curso, grupo=f.d.grupo, tutor=f.d.tutor, profesiones=f.d.profesiones, tel1=f.d.tel1, tel2=f.d.tel2, mail1=f.d.mail1, mail2=f.d.mail2) raise web.seeother('/admin/students')
def studadd_get(): del grades[:] db_grades = config.DB.select('grades') for grade in db_grades: grades.append((grade.grade, grade.grade)) del groups[:] db_groups = config.DB.select('groups') for group in db_groups: groups.append((group.groupe, group.groupe)) f = studadd_form(grades, groups) return render.studadd(f)