django-preserialize 1.0.6

Pre-serialize model instances and querysets
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).

last updated on:
September 11th, 2012, 21:26 GMT
price:
FREE!
developed by:
Byron Ruth
homepage:
github.com
license type:
BSD License 
category:
ROOT \ Internet \ Django Plugins

FREE!

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

Add your review!

SUBMIT