It's clear that the students had the opportunity to opt out of the class if the material was an issue.
Any parent could have notified the school ahead of time that they wanted their child to sit out that class.