Say I have a user id, and the users table also has a manytomany field "teacher id". This points to the teachers table. There is a substitutes table where a foreign key is teacher id, meaning that each substitute can only substitute for one teacher, but there may be many substitutes to that teacher. (This is not really what my fields represent, but I'm just using an example.) How, in Django, would I get all the substitute id's for all teachers who are teachers for a given user id? I know how to do it in SQL, but not really sure how the Django version is.
(This is similar to a question I had before, but not the same!)