1👍
✅
Try something like this:
files = File.objects.filter(users_id=request.user.id).annotate(count=Count('share__shared_user_id')
Then you should have
for f in files:
print f.file_name, f.count
Source:stackexchange.com