【发布时间】:2015-12-16 14:01:55
【问题描述】:
我有以下课程:
class Identity(Base):
"Identity model."
__tablename__ = 'identity'
id = Column('ID_IDENTITY', Integer, Sequence('identity_seq'), primary_key=True, nullable=False)
uuid = Column('DS_UUID', String(32), ForeignKey('customer.NX_UUID'), nullable=False)
type = Column('DS_TYPE', String(255), nullable=False)
value = Column('DS_VALUE', String(255), nullable=False)
和
class Customer(Base):
"Customer model."
__tablename__ = 'customer'
uuid = Column('NX_UUID', String(32), primary_key=True, nullable=False)
name = Column('DS_NICK_NAME', String(255), nullable=False)
identities = relationship(Identity, backref=backref('custome', cascade='all', uselist=True), lazy='dynamic')
我想发布一个传递身份列表的新客户,我尝试使用以下 json 来做到这一点:
{"name":"Teste", uuid: "12121212121","identities":[{"type":"cpf","value":"05882110955"}, {"CNPJ":"0123456656"}, {"RG":"AAA3243"}]}
但我得到了错误:
unhashable type: 'dict'
有什么想法可以做到这一点?
tks
【问题讨论】:
标签: python json flask flask-sqlalchemy