I've been working away on 
django-serializers<https://github.com/tomchristie/django-serializers>lately, 
and I've now got a
customizable serialization API that's backwards compatible with the existing
serializers, and is passing Django's serializer tests.

Exactly where I take this will depend on how Piotr Grabowski's GSoC project
progresses, but I'd certainly appreciate any input regarding the API design,
or if there would be any obvious blockers that'd prevent something along 
these
lines making it's way in as a replacement to the existing serializers.

This work intentionally doesn't (yet) address customizable deserialization,
and as such it currently only supports the existing loaddata 
deserialization.


Running the existing tests with django-serializers
==================================================

* Clone Django

* Install django-serializers

* Replace the existing dumpdata serializers with django-serializer's 
versions

In `django/core/serializers/__init__.py`, replace these strings:

"django.core.serializers.xml_serializer",
"django.core.serializers.python",
"django.core.serializers.json",
"django.core.serializers.pyyaml"

With these:

"serializers.dumpdata_xml",
"serializers.dumpdata_python",
"serializers.dumpdata_json",
"serializers.dumpdata_yaml"

* Run the serializer tests from Django's 'tests' directory

./runtests.py --settings=test_sqlite serializers serializers_regress


Example use-case
================

I've written a small app 
`django-auto-api<https://github.com/tomchristie/django-auto-api>` 
that uses `django-serializers`
to generate a read-only hyperlinked API for all installed models with 
`html`,
`json`, `yaml`, `xml` and `csv` outputs.

It demonstrates using custom relational fields between models to use
hyperlinking relationships rather than primary key relationships, and shows
how the customizable serialization can be used to build Web APIs with
very little code.


Summary
=======

As mentioned I'd appreciate any thoughts on what else it might take to 
bridge
the gap of getting this to the point where it could be adopted into core.

I think it should also serve as a decent point of reference for Piotr's 
GSoC project, in
particular `django-auto-api` is a good concrete use-case that I'd like any
customizable serialization proposal to be able to handle.


 - Tom

[1] django-serializers: https://github.com/tomchristie/django-serializers
[2] django-auto-api: https://github.com/tomchristie/django-auto-api

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/TI2XBLY4FK8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to