Permalink
Browse files

readme upd; closed #48

  • Loading branch information...
1 parent 1b1fc2a commit 8f47c74a0332cd3119b529695b099313afc458f8 @last-partizan last-partizan committed Feb 15, 2016
Showing with 23 additions and 0 deletions.
  1. +23 −0 README.rst
View
@@ -66,6 +66,29 @@ In your **settings.py** file, add following lines::
INSTALLED_APPS += ["django_mongoengine"]
+Documents
+=========
+Inhherit your documents from ``django_mongoengine.Document``,
+and define fields using ``django_mongoengine.fields``.::
+
+ from django_mongoengine import Document, EmbeddedDocument, fields
+
+ class Comment(EmbeddedDocument):
+ created_at = fields.DateTimeField(
+ default=datetime.datetime.now, required=True, editable=False,
+ )
+ author = fields.StringField(verbose_name="Name", max_length=255, required=True)
+ email = fields.EmailField(verbose_name="Email")
+ body = fields.StringField(verbose_name="Comment", required=True)
+
+ class Post(Document):
+ created_at = fields.DateTimeField(
+ default=datetime.datetime.now, required=True, editable=False,
+ )
+ title = fields.StringField(max_length=255, required=True)
+ slug = fields.StringField(max_length=255, required=True, primary_key=True)
+ comments = fields.ListField(fields.EmbeddedDocumentField('Comment'))
+
Sessions
========

0 comments on commit 8f47c74

Please sign in to comment.