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)
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)
def course_registration_save(): data = dict(request.form.items()) Studentclass.create(student_id=data.get('student_id'), classes_id=data.get('classes_id')) return jsonify(data)