‘method’ object does not support item assignment

I am trying to count likes on each post and this is my model. But I am getting error on the item detail page

likes = models.ManyToManyField(User, related_name='blog_posts')


    def total_likes(self):
        return self.likes.count()

VIEW:

class ItemDetailView(DetailView):
    model = Item
    template_name ='waqart/item_detail.html'

    
    def get_context_data(self, *args, **kwargs):
        context = super(ItemDetailView, self).get_context_data

        stuff = get_object_or_404(Item, id=self.kwargs['pk'])
        total_likes = stuff.total_likes()
        context['total_likes']= total_likes
        return context

Answer

You forgot to call get_context_data. Change it to:

context = super(ItemDetailView, self).get_context_data(*args, **kwargs)