diff --git a/restfulpy/orm/models.py b/restfulpy/orm/models.py index 4ff278c..52a91ec 100644 --- a/restfulpy/orm/models.py +++ b/restfulpy/orm/models.py @@ -6,6 +6,7 @@ from nanohttp import HttpBadRequest, context, HttpNotFound from sqlalchemy import Column, event from sqlalchemy.orm import validates, Query, CompositeProperty +from sqlalchemy.orm.attributes import InstrumentedAttribute from sqlalchemy.orm.relationships import RelationshipProperty from sqlalchemy.ext.hybrid import HYBRID_PROPERTY from sqlalchemy.ext.associationproxy import ASSOCIATION_PROXY @@ -33,7 +34,7 @@ def get_column(cls, column): @classmethod def import_value(cls, column, v): c = cls.get_column(column) - if isinstance(c, Column): + if isinstance(c, Column) or isinstance(c, InstrumentedAttribute): if c.type.python_type is bool and not isinstance(v, bool): return str(v).lower() == 'true' return v