Re: json and django - couple of questions.

2007-04-18 Thread MerMer
Thanks Russ, Since my last post I've also discovered the the "values" option which automatically converts the queery sets into a list of dictionaries. data=MyModel.objects.values('field1', 'field2') MerMer On Apr 18, 12:48 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 4/18/07, Me

Re: json and django - couple of questions.

2007-04-17 Thread Russell Keith-Magee
On 4/18/07, Merric Mercer <[EMAIL PROTECTED]> wrote: > > Via 'qs I can access the attribute and its value. However, 'data' does > not provide this extra attributes and value. Can anybody explain this - > is there a way I can do this? Not using the serialization framework. The serializer framew

Re: json and django - couple of questions.

2007-04-17 Thread Merric Mercer
The above should read data=serializers.serialize('json',qs) If I do qs[0].firstname I get the value of firstname, but this doesn't seem to be bundled in 'data' MerMer Merric Mercer wrote: > First Question:- > > In my view if I do:- > > qs=Model.objects.all() > for i in qs: > setattr(

json and django - couple of questions.

2007-04-17 Thread Merric Mercer
First Question:- In my view if I do:- qs=Model.objects.all() for i in qs: setattr( i, "firstname", firstname ) # add a new attribute ("firstname") with correponding value import django.core serializers data=serializers.serialize('json',data) render_to_response(template,{'data':data,'qs