django-serializers icondjango-serializers 0.5.1

Customizable serialization for Django
django-serializers is a Django app that provides flexible serialization of objects, models and querysets.

It is intended to be a potential replacement for the current, inflexible serialization. It should be able to support the current dumpdata format, whilst also being easy to override and customise.

Serializers are declared in a simlar format to Form and Model declarations, with an inner Meta class providing general options, and optionally with a set of Field classes being declaring inside the Serializer class.

The Serializer class itself also implements the Field interface, meaning we can represent serialization of nested instances in various different ways.

Installation

Install using pip:

pip install django-serializers

Optionally, if you want to include the django-serializer tests in your project, add serializers to your INSTALLED_APPS setting:

INSTALLED_APPS = (
 ...
 'seriliazers',
)


Note that if you have cloned the git repo you can run the tests directly, with the provided manage.py file:

manage.py test

Main features:

  • Supports serialization of arbitrary python objects using the Serializer class.
  • Supports serialization of models and querysets using ModelSerializer.
  • Supports serialization to the existing dumpdata format, using DumpDataSerializer.
  • Supports flat serialization, and nested serialization (to arbitrary depth), and handles recursive relationships.
  • Allows for both implicit fields, which are determined at the point of serialization, and explicit fields, which are declared on the serializer class.
  • The declaration of the serialization structure is handled independantly of the final encoding used (eg 'json', 'xml' etc…). This is desirable for eg. APIs which want to support a given dataset being output to a number of different formats.
  • Currently supports 'json', 'yaml', 'xml'.
  • Supports both ordered fields for readablity, and unordered fields for speed.
  • Supports both fields that corrospond to Django model fields, and fields that corrospond to other attributes, such as get_absolute_url.
  • Hooks throughout to allow for complete customization. Eg. Writing key names using javascript style camel casing.
  • Simple, clean API.
  • Comprehensive test suite.

last updated on:
July 2nd, 2012, 11:29 GMT
price:
FREE!
developed by:
Tom Christie
license type:
BSD License 
category:
ROOT \ Internet \ HTTP (WWW)

FREE!

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

Add your review!

SUBMIT