Exemple #1
0
 def get_context_data(self, **kwargs):
     context = super(SeasonDetail, self).get_context_data(**kwargs)
     context['round_list'] = Round.objects.filter(season_id=self.object.id).order_by('-id')
     context['rankings'] = Ladders.get_season_ranked_participants(self.object).prefetch_related(
         Prefetch('bot', queryset=Bot.objects.all().only('plays_race', 'user_id', 'name', 'type')),
         Prefetch('bot__user', queryset=User.objects.all().only('patreon_level', 'username','type')))
     context['rankings'].count = len(context['rankings'])
     return context
Exemple #2
0
 def get_queryset(self):
     try:
         return Ladders.get_season_ranked_participants(
             Season.get_current_season(), amount=10).prefetch_related(
             Prefetch('bot', queryset=Bot.objects.all().only('user_id', 'name')),
             Prefetch('bot__user', queryset=User.objects.all().only('patreon_level')))  # top 10 bots
     except NoCurrentSeason:
         return SeasonParticipation.objects.none()