Skip to content
Snippets Groups Projects
Commit 973283c6 authored by Hugo Kerstens's avatar Hugo Kerstens
Browse files

Delete solutions and widget when deleting problem

parent 7806afb4
No related branches found
No related tags found
1 merge request!5Add multiple choice checkbox location to database
......@@ -105,6 +105,10 @@ class Problems(Resource):
if any([sol.graded_by is not None for sol in problem.solutions]):
return dict(status=403, message=f'Problem has already been graded'), 403
else:
# Delete all solutions associated with this problem
for sol in problem.solutions:
db.session.delete(sol)
db.session.delete(problem.widget)
db.session.delete(problem)
db.session.commit()
return dict(status=200, message="ok"), 200
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment