Provides a binary django model field with automatic serialization/deserialization of native Python structures into/from MsgPack format.
It also comes with a form widget, basically a <TEXTAREA>
where data can be
input in JSON. This data is then converted to MsgPack when the form is submitted.
- Python 3.4+
- Django 1.8+ (tested with 1.8-3.0)
- msgpack-python
Install it with pip
(or easy_install
) :
pip3 install django-msgpackfield
Typical usage in a Django model:
from django.db import models
from msgpackfield import MsgPackField
class MyModel ( models.Model ) :
data = MsgPackField( null=True, blank=True )
obj = MyModel()
obj.data = { 'foo': 1, 'bar': 2, 'baz': [ 1, 2, 3, 4, 5 ] }
obj.save()