For instance, Model Resume contains variable number of Model Project 's,
What should be my models and relationships between them to achieve this ?
Thanks in advance.
views:
42answers:
2
+1
A:
You just need either a many to many field, or a foreign key from Model Project to Model Resume.
Olivier
2010-04-10 13:31:11
+1
A:
Seems to me that what you need is a many-to-many relationship between Resume 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')
Note that a default association table will be defined by Django under the hood this way.
And now you have a model in which a resume can be related with multiple projects and vice versa.
Satoru.Logic
2010-04-10 14:02:47