Skip to content

Instantly share code, notes, and snippets.

@rkorkosz
Created October 5, 2014 16:21
Show Gist options
  • Save rkorkosz/e2053be1142fc46de881 to your computer and use it in GitHub Desktop.
Save rkorkosz/e2053be1142fc46de881 to your computer and use it in GitHub Desktop.
Mongoengine models
import mongoengine
from mongoengine.django.auth import User
mongoengine.connect('todo')
class TodoItem(mongoengine.Document):
title = mongoengine.StringField(max_length=140)
due_date = mongoengine.DateTimeField(blank=True, null=True)
completed = mongoengine.BooleanField()
completed_date = mongoengine.DateTimeField(blank=True, null=True)
created_by = mongoengine.ReferenceField(User, related_name='todo_created_by')
note = mongoengine.StringField(blank=True, null=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment