I am new to Django and I have several issues related to multi-volume relational systems and Manytoone (e.g. foreign key).
My setup is as follows.
I have class A, class B, class C
Each object of class B must belong to an object of class A. They cannot belong to more than one class. A more practical example would be if class A is a music group and class B is a song with that group. Most groups will have more than one song, but each song must belong to a group (in this example, a song can never have multiple groups).
Class C is a list of individual group members. Therefore, each member of the group can be associated with an arbitrary number of songs, as well as with an arbitrary number of groups. In other words, a member of Band X can also be a member of group Y.
Then my question will be
How would I use the ForeignKey and ManytoMany relationship in this context?
This example is intended only to simplify my situation and help me explain my problem. I would like the administrator to display for each object of class C objects of class B or objects of class A belonging to class C. The same applies to class B and class A.
If you look at objects of class A, you can list all objects of class B that belong to this particular object of class A.
Any and all input is appreciated.
django django-models django-admin
Consiglieri
source share