Skip to content
This repository was archived by the owner on Mar 8, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion attrs_sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ def wrap(cls):
# which won't be ready yet.
for name in inspect(cls).columns.keys()
}
return attr.s(cls, these=these, init=False, hash=False)
those = {}
for attribute in these:
those[attribute] = cls.__dict__[attribute]
s = attr.s(these=these, init=False, hash=False)(cls)
for attribute in those:
setattr(cls, attribute, those[attribute])
return s

# `maybe_cls` depends on the usage of the decorator. It's a class if it's
# used as `@attrs_sqlalchemy` but `None` if it's used as
Expand Down