def get_queryset(self): round = self.request.query_params.get('round', None) if round is None: round = get_current_round() round_object = Round.objects.get(round=round) return Game.objects.filter(round=round_object)
def get_queryset(self): scores = RoundScore.objects.all() scores = [ score for score in scores if score.round.round <= get_current_round() ] return scores
def get_queryset(self): round = self.request.query_params.get('round', None) user = self.request.user current_round = get_current_round() if round is None: round = current_round else: round = int(round) # Get the tips for the round tips = Tip.objects.filter(user=user, round=round) # If its a future round, or an invalid round, return nothing if round>current_round or round<1: return tips # If it's the current round, and the user hasn't tipped yet, populate with defaults elif round==current_round and not tips: default_tips(round, user) tips = Tip.objects.filter(user=user, round=round) return tips
def get_queryset(self): round = self.request.query_params.get('round', None) user = self.request.user current_round = get_current_round() if round is None: round = current_round else: round = int(round) # Get the tips for the round tips = Tip.objects.filter(user=user, round=round) # If its a future round, or an invalid round, return nothing if round > current_round or round < 1: return tips # If it's the current round, and the user hasn't tipped yet, populate with defaults elif round == current_round and not tips: default_tips(round, user) tips = Tip.objects.filter(user=user, round=round) return tips
def CurrentRoundView(request): return JsonResponse({'round': get_current_round()})
def get_queryset(self): scores = RoundScore.objects.all() scores = [score for score in scores if score.round.round<=get_current_round()] return scores