Last active
August 29, 2015 14:01
-
-
Save chan-lee/e436c8e5dec893bbf1d9 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 RestModel(ndb.Model): | |
def to_dict(self, **kwargs): | |
result = super(RestModel, self).to_dict(**kwargs) | |
result['id'] = self.key.id() | |
parent_key = self.key.parent() | |
if parent_key is not None: | |
result['parent'] = parent_key.id() | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment