- This is a HEALIS gist for feedback on the web site healis.eu
- You can use Markup for on your comments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (C) By Josiah Carlson | |
# https://github.com/josiahcarlson/rom/issues/116 | |
# | |
def create_or_update(cls, data, **by): | |
entity = cls.get_by(**by) | |
if not entity: | |
entity = cls(**data) | |
else: | |
for k,v in data.items(): | |
setattr(entity, k, v) |
NewerOlder