Пример #1
0
    class MapperA(PolymorphicMapper):

        id = Integer(read_only=True)
        name = String()
        object_type = String(choices=['event', 'task'])

        __mapper_args__ = {
            'polymorphic_on': object_type,
            'allow_polymorphic_marshal': False,
        }
Пример #2
0
    class MapperBase(Mapper):

        __type__ = TestType

        name = String()
        age = Integer()

        def validate(self, output):
            if output.name == 'jack' and output.age != 36:
                raise MappingInvalid(
                    {'name': 'wrong age for jack', 'age': 'jack must be 36'})
Пример #3
0
    class MapperBase(Mapper):

        __type__ = TestType

        my_score = Integer(name='score')
Пример #4
0
    class MapperBase(Mapper):

        __type__ = TestType

        scores = Collection(Integer(), source='normalised_scores')
Пример #5
0
    class MapperBase(Mapper):

        __type__ = TestType

        score = Integer()
Пример #6
0
    class MapperBase(Mapper):

        __type__ = TestType

        score = Integer(source='normalised_score')
Пример #7
0
    class MapperBase(Mapper):

        __type__ = TestType

        id = Integer()
        name = String()
Пример #8
0
    class MapperBase(Mapper):

        __type__ = TestType

        id = Integer()
        name = String(name='my_name', source='name')