예제 #1
0
    def validate_rolls(self, rolls):
        """Make sure incoming rolls arrays are good"""
        # create a game object which won't be saved to the database
        # so we can check that our rolls list is valid
        test_game = Game(name="test_game", _rolls='[]')
        try:
            for roll in rolls:
                test_game.add_roll(roll)
        except:
            raise serializers.ValidationError("Rolls list was invald")

        return rolls
예제 #2
0
    def validate_rolls(self, rolls):
        """Make sure incoming rolls arrays are good"""
        # create a game object which won't be saved to the database
        # so we can check that our rolls list is valid
        test_game = Game(name="test_game", _rolls='[]')
        try:
            for roll in rolls:
                test_game.add_roll(roll)
        except:
            raise serializers.ValidationError("Rolls list was invald")

        return rolls