.. image:: https://travis-ci.org/MongoEngine/marshmallow-mongoengine.svg?branch=master
:target: https://travis-ci.org/MongoEngine/marshmallow-mongoengine
:alt: Travis-CI
.. image:: https://readthedocs.org/projects/marshmallow-mongoengine/badge/?version=latest
:target: http://marshmallow-mongoengine.readthedocs.org/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://coveralls.io/repos/github/MongoEngine/marshmallow-mongoengine/badge.svg?branch=master
:target: https://coveralls.io/github/MongoEngine/marshmallow-mongoengine?branch=master
:alt: Code Coverage
marshmallow-mongoengine
=======================
`Mongoengine <http://mongoengine.org>`_ integration with the `marshmallow
<https://marshmallow.readthedocs.org/en/latest/>`_ (de)serialization library.
See documentation at http://marshmallow-mongoengine.rtfd.org/
Declare your models
-------------------
.. code-block:: python
import mongoengine as me
class Author(me.Document):
id = me.IntField(primary_key=True, default=1)
name = me.StringField()
books = me.ListField(me.ReferenceField('Book'))
def __repr__(self):
return '<Author(name={self.name!r})>'.format(self=self)
class Book(me.Document):
title = me.StringField()
Generate marshmallow schemas
----------------------------
.. code-block:: python
from marshmallow_mongoengine import ModelSchema
class AuthorSchema(ModelSchema):
class Meta:
model = Author
class BookSchema(ModelSchema):
class Meta:
model = Book
author_schema = AuthorSchema()
(De)serialize your data
-----------------------
.. code-block:: python
author = Author(name='Chuck Paluhniuk').save()
book = Book(title='Fight Club', author=author).save()
dump_data = author_schema.dump(author).data
# {'id': 1, 'name': 'Chuck Paluhniuk', 'books': ['5578726b7a58012298a5a7e2']}
author_schema.load(dump_data).data
# <Author(name='Chuck Paluhniuk')>
Get it now
----------
::
pip install -U marshmallow-mongoengine
License
-------
MIT licensed. See the bundled `LICENSE <https://github.com/touilleMan/marshmallow-mongoengine/blob/master/LICENSE>`_ file for more details.
Raw data
{
"_id": null,
"home_page": "https://github.com/MongoEngine/marshmallow-mongoengine",
"name": "marshmallow-mongoengine",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "mongoengine marshmallow",
"author": "Emmanuel Leblond, Patrick Huck",
"author_email": "phuck@lbl.gov",
"download_url": "https://files.pythonhosted.org/packages/63/72/5cabacd62c5b4f81a1e955e0c54bb86d1289621e384f522552806f9ee101/marshmallow-mongoengine-0.31.2.tar.gz",
"platform": null,
"description": ".. image:: https://travis-ci.org/MongoEngine/marshmallow-mongoengine.svg?branch=master\n :target: https://travis-ci.org/MongoEngine/marshmallow-mongoengine\n :alt: Travis-CI\n\n.. image:: https://readthedocs.org/projects/marshmallow-mongoengine/badge/?version=latest\n :target: http://marshmallow-mongoengine.readthedocs.org/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. image:: https://coveralls.io/repos/github/MongoEngine/marshmallow-mongoengine/badge.svg?branch=master\n :target: https://coveralls.io/github/MongoEngine/marshmallow-mongoengine?branch=master\n :alt: Code Coverage\n\nmarshmallow-mongoengine\n=======================\n\n`Mongoengine <http://mongoengine.org>`_ integration with the `marshmallow\n<https://marshmallow.readthedocs.org/en/latest/>`_ (de)serialization library.\n\nSee documentation at http://marshmallow-mongoengine.rtfd.org/\n\nDeclare your models\n-------------------\n\n.. code-block:: python\n\n import mongoengine as me\n\n class Author(me.Document):\n id = me.IntField(primary_key=True, default=1)\n name = me.StringField()\n books = me.ListField(me.ReferenceField('Book'))\n\n def __repr__(self):\n return '<Author(name={self.name!r})>'.format(self=self)\n\n\n class Book(me.Document):\n title = me.StringField()\n\nGenerate marshmallow schemas\n----------------------------\n\n.. code-block:: python\n\n from marshmallow_mongoengine import ModelSchema\n\n class AuthorSchema(ModelSchema):\n class Meta:\n model = Author\n\n class BookSchema(ModelSchema):\n class Meta:\n model = Book\n\n author_schema = AuthorSchema()\n\n(De)serialize your data\n-----------------------\n\n.. code-block:: python\n\n author = Author(name='Chuck Paluhniuk').save()\n book = Book(title='Fight Club', author=author).save()\n\n dump_data = author_schema.dump(author).data\n # {'id': 1, 'name': 'Chuck Paluhniuk', 'books': ['5578726b7a58012298a5a7e2']}\n\n author_schema.load(dump_data).data\n # <Author(name='Chuck Paluhniuk')>\n\nGet it now\n----------\n::\n\n pip install -U marshmallow-mongoengine\n\nLicense\n-------\n\nMIT licensed. See the bundled `LICENSE <https://github.com/touilleMan/marshmallow-mongoengine/blob/master/LICENSE>`_ file for more details.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Mongoengine integration with the marshmallow (de)serialization library",
"version": "0.31.2",
"split_keywords": [
"mongoengine",
"marshmallow"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c4efec8be29d7f6dec0bae9391e8fae352a3d5b2ddb9be84a7d611a5b0e5c1de",
"md5": "54c94a5b98e3fde731c5991f67b0b670",
"sha256": "51de7614ce9002f9f679aebb6df7488297e791fbd07d9f14b963e9c7bce604ca"
},
"downloads": -1,
"filename": "marshmallow_mongoengine-0.31.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "54c94a5b98e3fde731c5991f67b0b670",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 12237,
"upload_time": "2023-03-14T05:42:50",
"upload_time_iso_8601": "2023-03-14T05:42:50.515868Z",
"url": "https://files.pythonhosted.org/packages/c4/ef/ec8be29d7f6dec0bae9391e8fae352a3d5b2ddb9be84a7d611a5b0e5c1de/marshmallow_mongoengine-0.31.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "63725cabacd62c5b4f81a1e955e0c54bb86d1289621e384f522552806f9ee101",
"md5": "bb127732bc70e2c9680456e84c3348b7",
"sha256": "a708732456e1a36139c6ce52910b57cf2a54e7206c5c635a48dba9e3e157d6db"
},
"downloads": -1,
"filename": "marshmallow-mongoengine-0.31.2.tar.gz",
"has_sig": false,
"md5_digest": "bb127732bc70e2c9680456e84c3348b7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11377,
"upload_time": "2023-03-14T05:42:51",
"upload_time_iso_8601": "2023-03-14T05:42:51.825367Z",
"url": "https://files.pythonhosted.org/packages/63/72/5cabacd62c5b4f81a1e955e0c54bb86d1289621e384f522552806f9ee101/marshmallow-mongoengine-0.31.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-14 05:42:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "MongoEngine",
"github_project": "marshmallow-mongoengine",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "marshmallow-mongoengine"
}