Django models: How to have a variable number of foreign keys in a model?

For example, the Model Resume contains a variable number of the Project Model .
What should be my models and the relationships between them to achieve this?
Thanks in advance.

+3
source share
2 answers

It seems to me that you need a many-to-many relationship between Renew and Project , so I would suggest doing something like this:

class Project(models.Model):
    # Project fields

class Resume(models.Model):
    # Resume fields
    projects = models.ManyToManyFields(Project, related_name='resumes')

, Django .

, resume .

+3

, Model Project Model Resume.

+2

Source: https://habr.com/ru/post/1740573/


All Articles