I am pickling Python Objects in Django and saving it in MySQL db. So far i have followed these simple rules:
cPickle.dumps(object)
#to convert
You can try this, now! django-picklefield https://pypi.org/project/django-picklefield/
To use, just define a field in your model:
>>> from picklefield.fields import PickledObjectField
... class SomeObject(models.Model):
... args = PickledObjectField()
and assign whatever you like (as long as it's picklable) to the field:
>>> obj = SomeObject()
>>> obj.args = ['fancy', {'objects': 'inside'}]
>>> obj.save()