vernon wrote:
> Hi,
>
> I'm trying to do something fairly simple (and doable), but I was
> wondering if there was a "best practices" approach. I'm developing a
> client-heavy app, and I'd like to return something like this to my
> JavaScript:
>
> {"posts": Post.objects.all(), "comments": Comment.objects.all()}
>
> Right now, I'm just running serializer.serialize on each of the query
> sets and constructing the JSON string myself, but I have more
> complicated use case where that becomes messy.
>   
I believe there is a python json module. I know that Django makes use of
it for importing/exporting database fixtures. It is bundled with django
at: django.utils.simplejson. I'd start there, and poke around in the
Django code for more examples. I'm no expert here, this is just where
I'd start looking.

Happy coding!


Jeff Anderson

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to