Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jaredlockhart/13a18cd7b95da192e837d572c6862e57 to your computer and use it in GitHub Desktop.
Save jaredlockhart/13a18cd7b95da192e837d572c6862e57 to your computer and use it in GitHub Desktop.
@staticmethod
def get_matches_for_hero_id(hero_id):
return (Match.objects
.filter(playerinmatch__hero__pk=hero_id, valid_for_model=True)
.order_by('-match_id')
.prefetch_related(
'playerinmatch',
'playerinmatch__hero',
'playerinmatch__hero',
'playerinmatch__item_0',
'playerinmatch__item_1',
'playerinmatch__item_2',
'playerinmatch__item_3',
'playerinmatch__item_4',
'playerinmatch__item_5',
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment