gather_subscriptions: Avoid extra queries fetching realm objects.

(imported from commit 591083cfaff454b8ce48aacb5da7913b8fe0a38f)
This commit is contained in:
Tim Abbott 2013-09-30 16:10:44 -04:00
parent 5e420dc5c3
commit e9ee05b2b2
1 changed files with 1 additions and 1 deletions

View File

@ -1452,7 +1452,7 @@ def gather_subscriptions(user_profile):
stream_ids = [sub.recipient.type_id for sub in subs]
stream_hash = {}
for stream in Stream.objects.filter(id__in=stream_ids):
for stream in Stream.objects.select_related("realm").filter(id__in=stream_ids):
stream_hash[stream.id] = stream
subscribed = []