3👍
✅
Actually, you are getting 404 error
from here.
step = get_object_or_404(Step, course_id=course_pk, pk=step_pk)
Here (get_object_or_404
) you are saying that if unable to find a Step with given course_id
and step_pk
then give 404
error and it is doing the same.
You need to make sure that the entries exist.
Your codes seem fine.
Source:stackexchange.com