On Fri, 2009-01-16 at 20:26 -0800, cptnwinky wrote:
> Thanks for replying.
> 
> I don't mean to sound crass but I did mention what the problem was.
> 
> Quote:
> I've even tried specifying in select_related which exact tables and
> fields I want returned however, only the results from Torrent table is
> returned.
> 
> The problem is it only returns results from the Torrent table when I
> need it to provide the corresponding results from TorrentInfo and
> TorrentTrackers as well. Perhaps I don't understand what
> select_related is supposed to do but I thought it was to get all the
> related results from the db based on the matching foreign keys.

It retrieves those values in a single database query. However, if you
don't specify select_related(), you can still access the related
attributes on the model and they will be retrieved on demand.
Select_related() does not change, in the slightest, what the data is
that is available to your Python code.

So is the problem that the related values are not accessible when you
refer to the attributes? Or that more than one database query is made?

Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to