django-preserialize is a Django app that makes sure an object is free of QuerySet and Model instances.
Install
pip install django-preserialize
Docs
A serialized user object might look like this:
>>> from preserialize.serialize import serialize
>>> serialize(user)
{
'date_joined': datetime.datetime(2009, 5, 16, 15, 52, 40),
'email': u'jon@doe.com',
'first_name': u'Jon',
'groups': [5],
'id': 1,
'is_active': True,
'is_staff': True,
'is_superuser': True,
'last_login': datetime.datetime(2012, 3, 3, 17, 40, 41, 927637),
'last_name': u'Doe',
'password': u'!',
'user_permissions': [1, 2, 3],
'username': u'jdoe'
}
This can then be passed off to a serializer/encoder, e.g. JSON, to turn it into a string for the response body (or whatever else you want to do).
Product's homepage
Requirements:
· Python
· Django