Skip to content

Instantly share code, notes, and snippets.

@onlinejudge95
Created November 24, 2019 00:19
Show Gist options
  • Save onlinejudge95/2e00b39b7cc590bf384303ce41606ec1 to your computer and use it in GitHub Desktop.
Save onlinejudge95/2e00b39b7cc590bf384303ce41606ec1 to your computer and use it in GitHub Desktop.
Making Flask-SQLAlchemy model subscriptable
class BaseModel(Model):
def __getitem__(self, key):
return self.__dict__[key]
class UserModel(BaseModel):
...
class AdminModel(BaseModel):
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment