Problem
CourseContentView.post creates multiple model instances (course content + child lesson/quiz/assignment) without a transaction boundary. If a later write fails (e.g. integrity error), earlier child objects can be left orphaned in the database.
Relevant call site: platform/api/views/courses.py — CourseContentView.post
Serializer write logic: platform/api/serializers/courses.py — CreateCourseContentRequest.to_django_model
Suggestion
Wrap the create path in transaction.atomic at the view or serializer boundary to ensure all writes succeed or none do.
Problem
CourseContentView.postcreates multiple model instances (course content + child lesson/quiz/assignment) without a transaction boundary. If a later write fails (e.g. integrity error), earlier child objects can be left orphaned in the database.Relevant call site:
platform/api/views/courses.py—CourseContentView.postSerializer write logic:
platform/api/serializers/courses.py—CreateCourseContentRequest.to_django_modelSuggestion
Wrap the create path in
transaction.atomicat the view or serializer boundary to ensure all writes succeed or none do.