1👍
✅
Please try following query, it would give you male/female separately.
from django.db.models import Max
male_results = Event.objects.filter(result__gender='M') \
.annotate(max_score=Max('result__score')) \
.values('name', 'result__person', 'result__score')
Source:stackexchange.com