Это относительно простое использование ManyToManyField.
class Book(models.Model):
name = models.CharField(max_length=140)
class UserProfile(models.Model):
favorites = models.ManyToManyField(Book, null=True, blank=True)
user = models.OneToOneField(User)
favorite_books = this_user_profile.favorites.all()
for b in Book.objects.all():
if b in favorite_books:
print "Book", b.name, "is a favorite of this user!"
else:
print "Book", b.name, "is not a favorite of this user!"
ETA: поскольку вы говорите, что хотите добавить его в шаблон, дайте его шаблону в виде списка кортежей.
book_list = [(b, (b in favorite_books)) for b in Book.objects.all()]
В вашем шаблоне есть код
{% for book, is_favorite in book_list %}
{% if is_favorite %}
{% comment %} Do something with this favorite book {% endcomment %}
{% else %}
{% comment %} Do something with this non favorite book {% endcomment %}
{% endif %}
{% endfor %}