defined property on user model not working

I am trying to get the received message count, but I am getting nothing in the template, also I have defined my modal after User, any better way of doing it?

this property is on User model

class User:
#some stuff ..

def get_message_count(self):
        messages_count = Messages.objects.filter(message_thread__receiver=self, opened=False).count()
    except ObjectDoesNotExist:
        messages_count = 0
    return messages_count


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"{self.message[:10]}"


</i> Messages <span class="badge rounded-pill bg-danger">{{request.user.get_message_count}}</span></a
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum