Django Model: many-to-many or many-to-one?
- by knuckfubuck
I'm just learning django and following a tutorial. I have a Link and a Bookmark. Unlike the tutorial I'm following, I would like a link to be associated with only one Bookmark, but a Bookmark can have multiple links. Is this the way to setup the model?
class Link(models.Model):
    url = models.URLField(unique=True)
    bookmark = models.ForeignKey(Bookmark)
class Bookmark(models.Model):
    title = models.CharField(maxlength=200)
    user = models.ForeignKey(User)
    links = models.ManyToManyField(Link)