METADATA 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. Metadata-Version: 2.0
  2. Name: marshmallow-mongoengine
  3. Version: 0.9.1
  4. Summary: Mongoengine integration with the marshmallow (de)serialization library
  5. Home-page: https://github.com/touilleMan/marshmallow-mongoengine
  6. Author: Emmanuel Leblond
  7. Author-email: emmanuel.leblond@gmail.com
  8. License: MIT
  9. Keywords: mongoengine marshmallow
  10. Platform: UNKNOWN
  11. Classifier: Intended Audience :: Developers
  12. Classifier: License :: OSI Approved :: MIT License
  13. Classifier: Natural Language :: English
  14. Classifier: Programming Language :: Python :: 2
  15. Classifier: Programming Language :: Python :: 2.7
  16. Classifier: Programming Language :: Python :: 3
  17. Classifier: Programming Language :: Python :: 3.3
  18. Classifier: Programming Language :: Python :: 3.4
  19. Classifier: Programming Language :: Python :: 3.5
  20. Provides-Extra: toasted
  21. Provides-Extra: marshmallow
  22. Requires-Dist: mongoengine (>=0.9.0)
  23. Provides-Extra: marshmallow
  24. Requires-Dist: marshmallow (>=2.1.0); extra == 'marshmallow'
  25. Provides-Extra: toasted
  26. Requires-Dist: toastedmarshmallow (>=0.2.6); extra == 'toasted'
  27. .. image:: https://travis-ci.org/MongoEngine/marshmallow-mongoengine.svg?branch=master
  28. :target: https://travis-ci.org/MongoEngine/marshmallow-mongoengine
  29. :alt: Travis-CI
  30. .. image:: https://readthedocs.org/projects/marshmallow-mongoengine/badge/?version=latest
  31. :target: http://marshmallow-mongoengine.readthedocs.org/en/latest/?badge=latest
  32. :alt: Documentation Status
  33. .. image:: https://coveralls.io/repos/github/MongoEngine/marshmallow-mongoengine/badge.svg?branch=master
  34. :target: https://coveralls.io/github/MongoEngine/marshmallow-mongoengine?branch=master
  35. :alt: Code Coverage
  36. marshmallow-mongoengine
  37. =======================
  38. `Mongoengine <http://mongoengine.org>`_ integration with the `marshmallow <https://marshmallow.readthedocs.org/en/latest/>`_ (de)serialization library (`toastedmarshamallow <https://pypi.python.org/pypi/toastedmarshmallow>`_ also supported).
  39. See documentation at http://marshmallow-mongoengine.rtfd.org/
  40. Declare your models
  41. -------------------
  42. .. code-block:: python
  43. import mongoengine as me
  44. class Author(me.Document):
  45. id = me.IntField(primary_key=True, default=1)
  46. name = me.StringField()
  47. books = me.ListField(me.ReferenceField('Book'))
  48. def __repr__(self):
  49. return '<Author(name={self.name!r})>'.format(self=self)
  50. class Book(me.Document):
  51. title = me.StringField()
  52. Generate marshmallow schemas
  53. ----------------------------
  54. .. code-block:: python
  55. from marshmallow_mongoengine import ModelSchema
  56. class AuthorSchema(ModelSchema):
  57. class Meta:
  58. model = Author
  59. class BookSchema(ModelSchema):
  60. class Meta:
  61. model = Book
  62. author_schema = AuthorSchema()
  63. (De)serialize your data
  64. -----------------------
  65. .. code-block:: python
  66. author = Author(name='Chuck Paluhniuk').save()
  67. book = Book(title='Fight Club', author=author).save()
  68. dump_data = author_schema.dump(author).data
  69. # {'id': 1, 'name': 'Chuck Paluhniuk', 'books': ['5578726b7a58012298a5a7e2']}
  70. author_schema.load(dump_data).data
  71. # <Author(name='Chuck Paluhniuk')>
  72. Get it now
  73. ----------
  74. ::
  75. pip install -U marshmallow-mongoengine
  76. License
  77. -------
  78. MIT licensed. See the bundled `LICENSE <https://github.com/touilleMan/marshmallow-mongoengine/blob/master/LICENSE>`_ file for more details.