Django serializer works really well when you need to serialize a QuerySet, 
but often times I need to serialize a JSON object with more than just a 
QuerySet.
This leads me to serialize the QuerySet, and then load it again to a python 
dict and then serialize it again. Like this:

peopleJSON = serializers.serialize("json", people_queryset)
people_dict = simplejson.loads(peopleJSON )
json = simplejson.dumps({'foo': foo, 'people':people_dict})

A better way would be:
data = {'foo':foo, 'people':people_queryset}
json = serializers.serialize("json", data)

Is there a reason not to allow this behavior? I can't think of one.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/37d98898-9dcd-4132-9bb2-b67a55aab008%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to