示例#1
0
class PostSchema(ma.ModelSchema):
    class Meta:
        model = Post
        sqla_session = db.session

    user = ma.Nested(UserSchema)
    comment = ma.Nested(CommentSchema, many=True)
示例#2
0
class PodcastSchema(ma.Schema):
    genres = ma.Nested(GenreSchema, many=True)

    class Meta:
        fields = ('id', 'name', 'kind', 'copyright', 'releaseDate',
                  'contentAdvisoryRating', 'url', 'artworkUrl100',
                  'artistName', 'artistId', 'artistUrl', 'genres')
示例#3
0
class StoreSchema(ma.ModelSchema):
    items = ma.Nested(ItemSchema, many=True)
    class Meta:
        model = StoreModel
        load_only = ("store")
        dump_only = ("id",)
        # to link with Store id
        include_fk = True
示例#4
0
class UserSchema(ma.ModelSchema):
    class Meta:
        model = UserModel
        load_only = (
            "password",
            "confirmation_token",
            "created_at",
        )
        dump_only = ("id", )
        ordered = True

    company = ma.Nested(CompanyLoadSchema)
示例#5
0
class UserSchema(ma.ModelSchema):
    email = ma.Email(required=True, validate=validate_email)
    password = ma.String(max_length=8,
                         validate=validate.Length(min=6, max=10),
                         required=True)
    profile = ma.Nested(ProfileSchema)

    class Meta:
        model = User
        fields = ('id', 'username', 'email', 'password', 'modified_on',
                  'profile')
        load_only = ('password', )
        dump_only = ('id', 'modified_on')
示例#6
0
class CompanyLoadSchema(ma.ModelSchema):
    name = ma.String()
    telephone = ma.String()
    default_off_days = ma.Int()
    address = ma.Nested(AddressSchema)
    employee_quota = ma.Nested(RemainingEmployeeSchema)
示例#7
0
class OrgApplicationSchema(ma.ModelSchema):
    application = ma.Nested(ApplicationSchema)

    class Meta:
        model = OrgApplication
示例#8
0
class CommentSchema(ma.ModelSchema):
    class Meta:
        model = Comment
        sqla_session = db.session

    user = ma.Nested(UserSchema)