def add_university(): json = request.get_json() uni = json['uni'] if University.get_uni(uni): return jsonify({"error": "University already exists"}), 201 University.add_university(uni) return jsonify({"message": "OK"}), 201
def populate_colleges(university): university = University.get_uni(university) colleges = [college['name'] for college in university['colleges']] return jsonify({"colleges": colleges})