picker/models/picks.py
def update_picks(self, games=None, points=None):
        '''
        games can be dict of {game.id: winner_id} for all picked games to update
        '''
        if games:
            game_dict = {g.id: g for g in self.gameset.games.filter(id__in=games)}
            game_picks = {pick.game.id: pick for pick in self.gamepicks.filter(game__id__in=games)}
            for key, winner in games.items():
                game = game_dict[key]
                if not game.has_started:
                    pick = game_picks[key]
                    pick.winner_id = winner
                    pick.save()

        if points is not None:
            self.points = points
            self.save()

        if games or points:
            self.updated_signal.send(sender=self.__class__, pickset=self, auto_pick=False)

        games can be dict of {game.id: winner_id} for all picked games to update
        
games can be dict of {game.id: winner_id} for all picked games to update
games can be dict of { game . id : winner_id } for all picked games to update
def update_picks(self, games=None, points=None):
        if games:
            game_dict = {g.id: g for g in self.gameset.games.filter(id__in=games)}
            game_picks = {pick.game.id: pick for pick in self.gamepicks.filter(game__id__in=games)}
            for key, winner in games.items():
                game = game_dict[key]
                if not game.has_started:
                    pick = game_picks[key]
                    pick.winner_id = winner
                    pick.save()
        if points is not None:
            self.points = points
            self.save()
        if games or points:
            self.updated_signal.send(sender=self.__class__, pickset=self, auto_pick=False)
def update_picks ( self , games = None , points = None ) : if games : game_dict = { g . id : g for g in self . gameset . games . filter ( id__in = games ) } game_picks = { pick . game . id : pick for pick in self . gamepicks . filter ( game__id__in = games ) } for key , winner in games . items ( ) : game = game_dict [ key ] if not game . has_started : pick = game_picks [ key ] pick . winner_id = winner pick . save ( ) if points is not None : self . points = points self . save ( ) if games or points : self . updated_signal . send ( sender = self . __class__ , pickset = self , auto_pick = False )
games can be dict of {game.id: winner_id} for all picked games to update
games can be dict of { game . id : winner_id } for all picked games to update
'''
        games can be dict of {game.id: winner_id} for all picked games to update
        '''
self
games
points