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
### Keybase proof | |
I hereby claim: | |
* I am peter-conalgo on github. | |
* I am dochex (https://keybase.io/dochex) on keybase. | |
* I have a public key whose fingerprint is 4589 779A DFC1 4F33 2753 4EA8 A3A3 1BAD 5A2A 5B10 | |
To claim this, I am signing this object: |
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
# Hack to allow me to type just ClassName[34] and fetch DB object with pk=34 | |
# | |
from flask.ext.sqlalchemy import _BoundDeclarativeMeta | |
def _get_by_pk(cls, idx): | |
return cls.get(idx) | |
_BoundDeclarativeMeta.__getitem__ = _get_by_pk |