django-preserialize 1.0.6

Pre-serialize model instances and querysets

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!
send us
an update
LICENSE TYPE:
BSD License 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Byron Ruth
HOMEPAGE:
github.com
CATEGORY:
ROOT \ Internet \ Django Plugins
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

requirements

#model instances #preserialize querysets #Django preserialize #Django #preserialize #model #instances

Add your review!

SUBMIT