From 7ebc720347d2fe44111fb2742392f18b57d6b407 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 15 Oct 2012 11:39:10 -0400 Subject: [PATCH] performance: Use select_related when computing autocomplete lists. (imported from commit fde08787998179451e6684a101c80aaafca917f6) --- zephyr/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zephyr/views.py b/zephyr/views.py index a693c00e6b..3558ac531c 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -158,10 +158,10 @@ def home(request): people = [{'email' : profile.user.email, 'full_name' : profile.full_name} for profile in - UserProfile.objects.filter(realm=user_profile.realm) if + UserProfile.objects.select_related().filter(realm=user_profile.realm) if profile != user_profile] - subscriptions = Subscription.objects.filter(userprofile_id=user_profile, active=True) + subscriptions = Subscription.objects.select_related().filter(userprofile_id=user_profile, active=True) streams = [get_display_recipient(sub.recipient) for sub in subscriptions if sub.recipient.type == Recipient.STREAM]