去除首页面,优化命名,优化schema
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
from applications.extensions import ma
|
||||
from marshmallow import fields
|
||||
from flask_marshmallow.sqla import SQLAlchemyAutoSchema
|
||||
|
||||
from applications.models import Role
|
||||
|
||||
|
||||
class RoleOutSchema(ma.Schema):
|
||||
id = fields.Integer()
|
||||
roleName = fields.Str(attribute="name")
|
||||
roleCode = fields.Str(attribute="code")
|
||||
enable = fields.Str()
|
||||
remark = fields.Str()
|
||||
details = fields.Str()
|
||||
sort = fields.Integer()
|
||||
create_at = fields.DateTime()
|
||||
update_at = fields.DateTime()
|
||||
class RoleOutSchema(SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Role # table = models.Album.__table__
|
||||
# include_relationships = True # 输出模型对象时同时对外键,是否也一并进行处理
|
||||
include_fk = True # 序列化阶段是否也一并返回主键
|
||||
# fields= ["id","name"] # 启动的字段列表
|
||||
# exclude = ["id","name"] # 排除字段列表
|
||||
|
||||
Reference in New Issue
Block a user