On Wed, Mar 10, 2010 at 1:57 AM, Jesus Mager <fon...@gmail.com> wrote: > 2010/3/2 Russell Keith-Magee <freakboy3...@gmail.com>: >> On Wed, Mar 3, 2010 at 12:46 AM, Jim N <jim.nach...@gmail.com> wrote: >>> Hi, > >> The short answer is you can't - at least, not out of the box. This is >> a feature that has been proposed several times [1] in the past. >> Django's serializers are primarily designed for use in the testing >> system, where the exact structure of the serialized output isn't as >> important. >> >> At some point, I'm hoping to be able to do a full teardown of the >> serialization infrastructure to make it completely configurable. This >> would enable features like [1], along with many others. >> >> In the interim, there is a third-party project called "Django Full >> Serializers" [2] that includes this sort of functionality. >> >> [1] http://code.djangoproject.com/ticket/4656 >> [2] http://code.google.com/p/wadofstuff/wiki/DjangoFullSerializers >> >> Yours, >> Russ Magee %-) >> > > > Hi russell! > > I'm trying to gather all things that are wanted and requested for > customizable serialization. I see custom in-depth serialization is > requested. But, what other features are wanted?
The ideal end goal is that you should be able to output any object (or list of objects), in any format, to any depth, with any additional information. This includes, but is not limited to: * Serializing nested structures (of arbitrary depth) * Serializing subsets of model attributes * Serializing non-database attributes/properties * Serialized output that doesn't match the current default output format (i.e., a model in JSON doesn't have to be {"pk": XX, "model": "myapp.foo", "fields": {...}} ) * Serialized output format that can change on a per-model basis * Serialized output format that can change based on where in the output tree the object is located (e.g., output the full User object if it's included from within model X, but only output the username if its included from within model Y) In short, we want serialization to be flexible. If we've made a design decision with Django's serializers, that decision should be customizable as an end user. Yours Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.