Exemplo n.º 1
0
def students_registered_class(classes):
    active_class = Classes.select().where(Classes.title**classes).get()
    student_ids = Studentclass.select().where(
        Studentclass.classes_id == active_class.id)
    results = []
    for student_id in student_ids:
        student = Student.select().where(Student.id == student_id).get()
        results.append({'name': student.name, 'email': student.email})
    return jsonify(results)
Exemplo n.º 2
0
def students_registered_students(student):
    active_student = Student.select().where(Student.email**student).get()
    classes_ids = Studentclass.select().where(
        Studentclass.classes_id == active_classes.id)
    results = []
    for classes_id in classes_ids:
        student = Student.select().where(Classes.id == classes_id).get()
        results.append({
            'description': classes.description,
            'title': classes.title
        })

    return jsonify(results)