示例#1
0
        class Person(mod_object.AbstractModel):

            name = mod_object.FieldConverter('name')
            family_name = mod_object.FieldConverter('familyName')
            age = mod_object.FieldConverter()
            aliases = mod_object.ObjectsListFieldConverter(Alias)
            main_alias = mod_object.ObjectFieldConverter(Alias, json_field_name='mainAlias')

            def __init__(self):
                mod_object.AbstractModel.__init__(self)
示例#2
0
        class Person(mod_object.AbstractModel):

            name = mod_object.FieldConverter('name')
            family_name = mod_object.FieldConverter('familyName')
            age = mod_object.FieldConverter()

            # Nonstandard deserialization the first not-null JSON element must be used:
            main_alias = [mod_object.FieldConverter('mainAlias.name'), mod_object.FieldConverter('aliases.0.name')]

            def __init__(self):
                mod_object.AbstractModel.__init__(self)
示例#3
0
        class Alias(mod_object.AbstractModel):

            name = mod_object.FieldConverter()

            def __init__(self):
                mod_object.AbstractModel.__init__(self)