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( 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':qs,})
>
> 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?
>
> Second Question.
> Using json or xml is there a simple to only return the fields that I
> need in a query set, rather than all the data?
>
> MerMer
>
>
> >
>
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---