Created
December 19, 2016 17:38
-
-
Save blaix/f536054d429682a9bdcdc985aa919ee0 to your computer and use it in GitHub Desktop.
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
class BaseModel: | |
fields = () | |
def __init__(self, **data): | |
for key, val in data.items(): | |
setattr(self, key, val) | |
class MyModel(BaseModel): | |
fields = ('field1', 'field2', 'field3') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment