i wanted to create a topic model.
this model would have a foreign key, non required, to the topic above it
for example:
iphone has a foreign key to apple
but what do i do if i want apple to be linked to all of its sub elements
apple to iPhone
apple to mac
i know that there are many to many fields, but how exactly would you apply them to this
situation
furthermore mac or iPhone might even have more sub elements
You probably want to look at the documentation for
related_name. Basically Django does this for you. For example:Then access this code: