get_stream: Fetch the realm object as well.

(imported from commit 065ae574cb933cfc48371efd4327e70d37184dd4)
This commit is contained in:
Tim Abbott 2013-03-18 11:31:45 -04:00
parent c6c3cda089
commit c0fece1cbd
1 changed files with 2 additions and 1 deletions

View File

@ -179,7 +179,8 @@ def get_stream(stream_name, realm):
else:
realm_id = realm
try:
return Stream.objects.get(name__iexact=stream_name.strip(), realm_id=realm_id)
return Stream.objects.select_related("realm").get(
name__iexact=stream_name.strip(), realm_id=realm_id)
except Stream.DoesNotExist:
return None