Skip to content

Instantly share code, notes, and snippets.

@namlook
Created September 26, 2013 12:27
Show Gist options
  • Save namlook/6713455 to your computer and use it in GitHub Desktop.
Save namlook/6713455 to your computer and use it in GitHub Desktop.
MongoKit inheritance simple example
from datetime import datetime
class Core(mongokit.Document):
__database__ = "elkorado"
use_dot_notation = True
structure = {
"created_at": datetime,
"updated_at": datetime
}
default_values = {
"created_at": datetime.utcnow,
"updated_at": datetime.utcnow
}
def save(self, *args, **kwargs):
self.updated_at = datetime.utcnow()
super(Core, self).save(*args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment