I want to display some text message on the page if there are no content on it. For e.g if the User doesn't have any favorites and the User clicks the my favorite page, I want to display something like "you don't have any favorites" on the my favorite page.
This is my model favorite:
class Favorite(models.Model):
user_id = models.ForeignKey(User, on_delete=models.CASCADE)
content_id = models.ForeignKey(ContentItem, on_delete= models.CASCADE)
Now, if I had OneToOneField instead of Foreignkey, I could have done the following in favorites.html
{% if not user.favorite %}
<H2>Oops, You don't have any Favorites </H2>
Please visit <a href="{% url 'index' %}">our page</a> to make some favorites
{% endif %}
but it can't be OneToOneField because of course one User can have many favorites.
Thanks in advance
Edit: How can this possibly be duplicate of the mentioned question, another question is related to the answer of this question, that's all. How can a user know about that question before knowing the answer to this question? My question is doing about "x", there is a certain relation "r" in django, which can help me do "x" (probably not the only way), another question is what does "r" do? Now how can this question be duplicate of another question?
Edit2: And downvote for not knowing the answer to certain problem? I think the question shows some research, is clear and concise.