1👍
✅
You have two options:
Use M2M field in the Article
model:
class Article(models.Model):
...
liked_by = models.ManyToManyField(User)
Or create the intermediate table by yourself (which is the second snippet in our question):
class LikeArticleUser(models.Model):
article = models.ForeignKey(Article)
user = models.ForeignKey(User)
SQL representation for both options will be the same so which option you choose is a matter of taste.
Source:stackexchange.com