def list_courses(university_name): """ List all courses associated with a university """ courses = [] university_ref = University.get_by_key_name(university_name) university_course_ref = db.GqlQuery("SELECT * FROM UniversityCourse WHERE " + "university = :1", university_ref) for course_ref in university_course_ref.run(): course_key = UniversityCourse.course.get_value_for_datastore(course_ref) course_res = Course.get(course_key) courses.append(course_res) return courses
def list_courses(user_email): """ List all courses associated with a user """ from lib.UserCourse import UserCourse courses = [] user_ref = User.get_by_key_name(user_email) user_course_ref = db.GqlQuery("SELECT * FROM UserCourse WHERE " +\ "user = :1", user_ref) for course_ref in user_course_ref.run(): course_key = UserCourse.course.get_value_for_datastore(course_ref) course_res = Course.get(course_key) courses.append(course_res) return courses
def list_courses(university_name): """ List all courses associated with a university """ courses = [] university_ref = University.get_by_key_name(university_name) university_course_ref = db.GqlQuery("SELECT * FROM UniversityCourse WHERE " +\ "university = :1", university_ref) for course_ref in university_course_ref.run(): course_key = UniversityCourse.course.get_value_for_datastore( course_ref) course_res = Course.get(course_key) courses.append(course_res) return courses