I am on svn version as of two days back.
I am using values(*fields) to create an output from my table.
(following using print statement)
out_list=Food.objects.filter(group__exact=my_group).values('food_name','group','description')
print out_list
[{'food_name': u'nirvana', 'group': 1L, 'description': u'nirvana1'},
{'food_name': u'dj new versio', 'group': 1L, 'description':
u'jsklajdkls'}, {'food_name': u'PMC', 'group': 1L, 'description':
u'jsklajdkls'}]
( why do I see u before text in output above?)
when I try json serailize It throws an exception:
i tried following, none seems to work, any clues-
from django.core.serializers import serialize
a) json_out_list= serialize('json',out_list)
b) json_serializer = serializers.get_serializer("json")()
json_out_list = json_serializer.serialize(out_list,
ensure_ascii=False, stream=response)
c) data = serializers.serialize('json',
Food.objects.filter(group__exact=my_group),
fields=('food_name','group','description'))
Any clues?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---