Re: select_related() depth when specifying fields

2010-06-11 Thread Michael Hrivnak
I really appreciate your help Dan, but I don't think the answer to my question is in the docs. I did my due diligence there before asking. Regarding your suggestion, from the docs: "It's an error to use both a list of fields and the depth parameter in the same select_related() call, since they

Re: select_related() depth when specifying fields

2010-06-10 Thread Dan Harris
Michael, I believe the case of query.select_related(person__place) will "only" follow the place foreign key. This means that if you had 5 FK's in your person models, that only a single FK would be followed instead of all 5 for optimization. Upon further looking there is also a "depth" argument you

Re: select_related() depth when specifying fields

2010-06-10 Thread Dan Harris
According to the select_related() documentation at: http://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.QuerySet.select_related it looks like select related "follows foreign keys as far as possible". In the documentation example it shows select_related following a foreign k

Re: select_related() depth when specifying fields

2010-06-10 Thread Michael Hrivnak
I read that myself. I asked the question because it goes on to state that you can specify down-stream models like this: query.select_related(person__place) If it follows all relationships as far as possible, even when specific relationships are requested, why would that syntax ever be necessar

select_related() depth when specifying fields

2010-06-10 Thread Michael Hrivnak
If I use select_related() on a queryset and specify some attribute names, will it follow those relationships as far as possible, or does that imply "depth=1"? Thanks, Michael signature.asc Description: This is a digitally signed message part.