1๐
โ
I highly recommend checking out the Django documentation on models which can be found here: Django Models
Moreover, to make a symmetrical Many to Many relationship, use:
class B(models.Model):
bs = models.ManyToManyField("self")
Additionally, I recommend making the relationship between A and B a many to many relationship instead of a foreign key. This will allow you to assign the B to many Aโs while still allowing 1 A to have many Bโs. The same logic should potentially be taken for B and C.
To answer your question about making Bโs required for A, I do not think this is possible. Check out this question for more information: Django 1.7: how to make ManyToManyField required?
๐คWritten
Source:stackexchange.com