This is enough to determine the relationship in one of the models. Django will automatically create an attribute in another model.
If you want the link to be associated with only one bookmark, specify the foreign key in Link , which refers to the Bookmark object:
class Bookmark(models.Model): title = models.CharField(max_length=200) user = models.ForeignKey(User) class Link(models.Model): url = models.URLField(unique=True) bookmark = models.ForeignKey(Bookmark)
To access bookmark links, use bookmark.link_set . This attribute is automatically generated by Django.
source share