On Sun, Dec 28, 2008 at 5:32 AM, adambossy <adambo...@gmail.com> wrote: > > Russ, > > Thanks for the reply. Specifically, I am wondering if there is some > feature of the Models API that allows me to retrieve the foreign key > object so that it is included in the serialized string. That is, > without writing my own serializer (which I suspect I may have to do).
The serializer is decoupled from the Model API, so your question is unrelated to the model API. Serialization exploits the model metatdata embedded in models; the issue in this case is that the data extracted from the model by the serializer doesn't meet your requirements. You want to have a different serialization format (i.e., you want to roll out serialized objects in a different format to that provided by default). This means you will need to write your own serializer. Looking for deeper solutions to this problem - Ticket #4656 possibly describes part of your problem - this ticket describes an enhancement that would allow the serializer to follow. This would be much like the select_related() operator on querysets, but for serialization. This ticket hasn't seen any activity for a while, but it has been accepted for inclusion as soon as a working implementation is available. There is also a lingering ticket idea floating around - it has been suggested many times that Django's serializers are not flexible enough - that your use case should be a matter of configuring Django's serializer, rather than writing a new serializer from scratch. In principle, I have no objection to this idea - but I am yet to see a good proposal for what such configuration would look like. > I'll keep tinkering... Let me know if you have any ideas. Let me know if you have any :-) 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---