Answer the question
In order to leave comments, you need to log in
How to link two models and save?
Hello!
There are "Competition" and "Team" models:
models.py
class Competition(models.Model):
name = models.CharField(max_length=30)
class Team(models.Model):
myteam_name = models.CharField(max_length=30)
Answer the question
In order to leave comments, you need to log in
In a simple way , you can store information about these relationships:
class Competition(models.Model):
name = models.CharField(max_length=30)
teams = models.ManyToManyField(Team)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question