On Tue, May 6, 2008 at 8:52 AM, Explore <[EMAIL PROTECTED]> wrote:
>
>  Hi. I have been trying to get django to return my models as xml.  I
>  have tried using the xml serializer but i cannot get it to send back
>  anything but the initial model.
>
>  I would like to get nested xml like below (where Department has a
>  ForeignKey to Organization).

That may be what you want, but that's not what the Django serializer
provides. The original design goal of the Django serializer was to
allow for the definition of fixtures; output in the format you
describe only serves to complicate the deserialization process.

However, the idea is a good one. What you have requested has been
suggested before. It is logged as ticket 4656 [1], and has been
accepted as a feature request.

[1] http://code.djangoproject.com/ticket/4656

As I see it, you have two options:
1) Write your own custom XML serializer that outputs the format you
want. Serializers are actually pretty simple to write - it's
deserializers that cause the most problems, so this probably isn't as
difficult as you think.

2) Work out a patch to allow this sort of expansion in the Django
serializers. If a patch (with tests and documentation) were to be
provided, it would eventually find itself in the trunk.

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