minor: Use dict comprehension in get_messages_backend().

This commit is contained in:
Steve Howell 2017-11-07 07:18:42 -08:00 committed by Tim Abbott
parent 47c63217cc
commit c62588c359
1 changed files with 4 additions and 3 deletions

View File

@ -735,9 +735,10 @@ def get_messages_backend(request, user_profile,
message_ids = [row[0] for row in query_result]
# TODO: This could be done with an outer join instead of two queries
user_message_flags = dict((user_message.message_id, user_message.flags_list()) for user_message in
UserMessage.objects.filter(user_profile=user_profile,
message__id__in=message_ids))
um_rows = UserMessage.objects.filter(user_profile=user_profile,
message__id__in=message_ids)
user_message_flags = {um.message_id: um.flags_list() for um in um_rows}
for row in query_result:
message_id = row[0]
if user_message_flags.get(message_id) is None: