how to serialise a enum property in sqlalchemy using marshmallow

后端 未结 3 1287
感情败类
感情败类 2021-01-12 02:01

this is my model class

class Type(enum.Enum):
    Certified = \"certified\"
    Non_Certified = \"non-certified\"


class Status(enum.Enum):
    Approved = \         


        
3条回答
  •  终归单人心
    2021-01-12 02:30

    Another alternative is to override the __str__ method of your Enum. E.g.

    class Type(enum.Enum):
        Certified = "certified"
        Non_Certified = "non-certified"
    
        def __str__(self):
            return self.value
    

提交回复
热议问题