I have some models that look like this:
class UserProfile(models.Model):
user = models.OneToOneField(User)
favorite_books = models.ManyToManyField(Book)
# ...
class Book(models.Model):
title = models.CharField(max_length=255)
How can I tell how many times a Book has been favorited?
You can query the “through” table directly with the ORM: