Re: accessing related fields of model

2009-03-19 Thread Malcolm Tredinnick
On Thu, 2009-03-19 at 13:20 -0700, adrian wrote: > > The doc gives this example for querying an Entry model which has a > foreign key field to a Blog model. > > e = Entry.objects.get(id=2) > e.blog = some_blog > > Fine. Now if I do it in a loop like this: > > e = Entry.objects.all() > for ent

Re: accessing related fields of model

2009-03-19 Thread Daniel Roseman
On Mar 19, 8:20 pm, adrian wrote: > The doc gives this example for querying an Entry model which has a > foreign key field to a Blog model. > > e = Entry.objects.get(id=2) > e.blog = some_blog > > Fine.  Now if I do it in a loop like this: > > e = Entry.objects.all() > for entry in e: >     entry

Re: accessing related fields of model

2009-03-19 Thread adrian
I found a serializer that can follow foreign key fields, which solves my problem. http://code.google.com/p/wadofstuff/wiki/DjangoFullSerializers But I would still like to understand if someone cares to answer! I think this should be in the documentation also. On Mar 19, 3:20 pm, adrian wrote

accessing related fields of model

2009-03-19 Thread adrian
The doc gives this example for querying an Entry model which has a foreign key field to a Blog model. e = Entry.objects.get(id=2) e.blog = some_blog Fine. Now if I do it in a loop like this: e = Entry.objects.all() for entry in e: entry.blog = some_blog #do stuff here with Entry and B