I found what I needed here
http://blog.michaeltrier.com/2007/7/30/json-generic-serializer
Ashish
On Mar 31, 2:27 pm, ydjango <[EMAIL PROTECTED]> wrote:
> thanks.
>
> also when I add 'id' in fields, it appears to just ignore it, I get
> back only food_name , group and description. Is it by
thanks.
also when I add 'id' in fields, it appears to just ignore it, I get
back only food_name , group and description. Is it by design or a bug?
serializers.serialize('json',Food.objects.filter(group__exact=my_group),fields=('id','food_name','group','description'))
thanks
Ashish
On Mar
On Mon, 31 Mar 2008, ydjango wrote:
> u'jsklajdkls'}, {'food_name': u'PMC', 'group': 1L, 'description':
> u'jsklajdkls'}]
> ( why do I see u before text in output above?)
It indicates that they're unicode strings.
--~--~-~--~~~---~--~~
You received this message
I was able to get this to work. There was an import error from my
side,
data =
serializers.serialize('json',Food.objects.filter(group__exact=my_group),fields=('food_name','group','description'))
following two serialization ways gave me exception -
'dict' object has no attribute '_meta'
a)
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,
5 matches
Mail list logo