code: def likes_count(obj):
      
      return Like.objects.filter(
          receiver_content_type=ContentType.objects.get_for_model(obj),
          receiver_object_id=obj.pk
      ).count()
docs: Usage:
  
          {% likes_count obj %}
      or
          {% likes_count obj as var %}
      or
          {{ obj|likes_count }}