Re: JSON Model Serialization

2009-03-30 Thread Mateusz Wawrzyniak
On Mar 24, 11:05 am, gchuyun wrote: > i tried this, but get a error similar. > > TypeError: [{'publish_time': datetime.datetime(2009, 3, 24, 16, 16, > 18), 'is_deleted': 0, 'is_confirmed' > : 0, 'title': u'1', 'content': u'111', 'id': 1L}, {'publish_time': > datetime.datetime(2009, 3, 24, 16 > ,

Re: JSON Model Serialization

2009-03-24 Thread gchuyun
i tried this, but get a error similar. TypeError: [{'publish_time': datetime.datetime(2009, 3, 24, 16, 16, 18), 'is_deleted': 0, 'is_confirmed' : 0, 'title': u'1', 'content': u'111', 'id': 1L}, {'publish_time': datetime.datetime(2009, 3, 24, 16 , 27, 50), 'is_deleted': 0, 'is_confirmed': 0, 'titl

Re: JSON Model Serialization

2009-03-15 Thread Mateusz Wawrzyniak
On Mar 14, 10:14 pm, MartinBorthiry wrote: > Hello: > >  I'm Trying to serialize a dict which have a list of Model's instance. > The format that i need is json. Something  like that: > >     people = Person.objects.all() Why don't you use Person.objects.values()? You will get a list of dicts s

Re: JSON Model Serialization

2009-03-15 Thread bruno desthuilliers
On 15 mar, 18:39, MartinBorthiry wrote: (snip) > Bruno, Thank you for your reply. > I tried your snipper, but I had the same error. Uh ? How did you try it (please provide relevant code) ? This code is used in production and AFAICT, it JustWork(tm), so if you happened to find a bug, I'd rea

Re: JSON Model Serialization

2009-03-15 Thread MartinBorthiry
> > I'm Trying to serialize a dict which have a list of Model's instance. > > The format that i need is json. Something like that: > > > people = Person.objects.all() > > res = {'res':0, 'msg':'Ok','data': people} > > > but, i need that result: > > {'res':0, 'msg':'

Re: JSON Model Serialization

2009-03-14 Thread bruno desthuilliers
On 14 mar, 22:14, MartinBorthiry wrote: > Hello: > > I'm Trying to serialize a dict which have a list of Model's instance. > The format that i need is json. Something like that: > > people = Person.objects.all() > res = {'res':0, 'msg':'Ok','data': people} > > but, i need that

JSON Model Serialization

2009-03-14 Thread MartinBorthiry
Hello: I'm Trying to serialize a dict which have a list of Model's instance. The format that i need is json. Something like that: people = Person.objects.all() res = {'res':0, 'msg':'Ok','data': people} but, i need that result: {'res':0, 'msg':'Ok','data': [{'id':1