Multiple model dependencies

(Roostercrab) #1

Hello everyone!

I have followed the tutorial to implement dependent models and have been able to make it work by putting my model names into it, but I have a question about expanding it further.

I am trying to chain multiple models to each other in a hierarchy of about 4 in the same way that the city was chained to the country, but I am trying to make a classification hierarchy for questions in a school app that I am building.

So each question would be able to be classified by a Curriculum, then a Subject, then a Topic, then a Subtopic, and finally I also included a Minutiae model just in case someone every wants to specify their questions to that level. This level of granularity will let the teacher see what topics specifically that a student is succeeding or failing at.

I always find your explanations to be the clearest on the web, and I thank you for that. Any perspective you or anyone on the forum could offer on chaining multiple models to each other would be greatly appreciated, here is a link to the repo if anyone would like to see it:

0 Likes

(Lúcio Henrique) #2

Take a look at django-mptt. It´s not a chained relation but a technique to store hierarchical data in the database. In your case, I believe not having a defined structure (like country >> state >> city) can be a better alternative. Think that some topic or subject also can be related to two or more curriculum. So, give a chance to mptt.

0 Likes