On Sat, Nov 8, 2008 at 1:35 AM, Ivan Tarradellas <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> With Django, what is the easy and best way to serialize/deserialize
> objects that are no Django objects?
>
> django.core.serializers only works with Django objects. But what
> happens if we have other object type?

The short answer is "you have to build the serializer yourself".
Django doesn't provide any mechanism for serializing arbitrary Python
objects.

The long answer depends on the serializer you want to use. Django's
model serialization module builds on a number of other libraries
(Python's builtin XML handling, simpleJSON, YAML, etc). These
libraries handle the logic for how to serialize python primitive types
(integer, list, etc). The Django serialization module describes how to
decompose a django model instance into a series of primitives.

If you want to serialize your own arbitrary object, you will need to
come up with a similar set of rules, and wrap it around the base
serialization libraries.

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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to