title: defined property on user model not working
body: <p>I am trying to get the received message count, but I am getting nothing in the template, also I have defined my modal after <em>User</em>, any better way of doing it?</p>
  <p><em>this property is on User model</em></p>
  <pre class="lang-py prettyprint-override"><code>class User:
  #some stuff ..
  
  @property
  def get_message_count(self):
      try:
          messages_count = Messages.objects.filter(message_thread__receiver=self, opened=False).count()
      except ObjectDoesNotExist:
          messages_count = 0
      return messages_count
  </code></pre>
  <p>model</p>
  <pre class="lang-py prettyprint-override"><code>class MessageThreads(models.Model):
      sender = models.ForeignKey(User, on_delete=models.SET_NULL, related_name='sender', null=True)
      receiver = models.ForeignKey(User, on_delete=models.SET_NULL, related_name='receiver', null=True)
      created_date = models.DateField(auto_now_add=True)
      created_time = models.TimeField(auto_now_add=True)
  
  class Messages(models.Model):
      message_thread = models.ForeignKey(MessageThreads,on_delete=models.CASCADE,null=True)
      message = models.TextField(max_length=600,blank=True)
      sent_date = models.DateField(auto_now_add=True)
      sent_time = models.TimeField(auto_now_add=True)
      opened = models.BooleanField(default=False)
      
      def __str__(self):
          return f&quot;{self.message[:10]}&quot;
  </code></pre>
  <p>template</p>
  <pre><code>&lt;/i&gt; Messages &lt;span class=&quot;badge rounded-pill bg-danger&quot;&gt;{{request.user.get_message_count}}&lt;/span&gt;&lt;/a
  </code></pre>