I have a class Environment that has a list of Video objects (relationship One-To-Many), and in the class Video, i have a relationship with Environment of Many-To-One.
How to express this in Django?
I have a class Environment that has a list of Video objects (relationship One-To-Many), and in the class Video, i have a relationship with Environment of Many-To-One.
How to express this in Django?
You need to set a foreign key in your model Video this
class Video(models.Model):
environment = models.ForeignKey(Environment)
You need to have a look of foreignkey in django
A foreign key is a many-to one relationship. In your example, one Environment can have many videos.