Get assignments in a course #56
@@ -139,6 +139,19 @@ def get_students_in_course(id):
|
||||
resp["students"].append(s.to_dict())
|
||||
return jsonify(resp)
|
||||
|
||||
@bp.route("/course/<int:id>/assignments", methods=["GET"])
|
||||
@login_required
|
||||
def get_assignments_in_course(id):
|
||||
c = Course.query.get(id)
|
||||
if not c:
|
||||
return error_response(400, f"course with id {id} not found")
|
||||
|
||||
assignments = c.assignments.all()
|
||||
resp = {"assignments": []}
|
||||
for a in assignments:
|
||||
resp["assignments"].append(a.to_dict())
|
||||
return jsonify(resp)
|
||||
|
||||
|
||||
@bp.route("/course/<int:id>", methods=["GET"])
|
||||
@login_required
|
||||
|
||||
Reference in New Issue
Block a user