On 06/07/2010 05:46 PM, Łukasz Rekucki wrote:
> On Jun 6, 10:12 pm, Tomas Kouba <to...@jikos.cz> wrote:
>> Hello all,
>>
>> I am writing an application that often lists objects and some of their
>> attributes in tables.
>> I get the list in my view and then access attributes in template.
>> It means that the table rendering results in many simple sql queries
>> (first to get the list and then
>> one query for every row).
>> Is there a way how to this in a more effective way? I can get the data
>> with one sql query
>> but it would involve some "low level" python DB access and I am curious
>> if this is possible
>> in a more "djangoish" way.
> Sounds like select_related() is the thing you need:
> http://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.QuerySet.select_related

Thank you very much. That was right the thing I was looking for.

-- 
Tomas Kouba

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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