Skip to content

Instantly share code, notes, and snippets.

@fission6
Created January 5, 2012 19:50
Show Gist options
  • Save fission6/1566908 to your computer and use it in GitHub Desktop.
Save fission6/1566908 to your computer and use it in GitHub Desktop.
monkey patch django User to access Mongo Document
@property
def document(self):
user_id = self.id
user_document = UserDocument.objects.get(user_fk=user_id)
return user_document
User.add_to_class("document", document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment