Use a generator comprehension for history messages.

(imported from commit 1f3079cb33ea1feae0290e02778cb383726fd8c9)
This commit is contained in:
Tim Abbott 2013-04-11 15:24:11 -04:00
parent 0e1842f77c
commit 34977a4017
1 changed files with 3 additions and 4 deletions

View File

@ -687,10 +687,9 @@ def get_old_messages_backend(request, user_profile,
+ list(query.filter(**add_prefix(id__gte=anchor))[:num_after]))
if include_history:
user_messages = {}
for user_message in UserMessage.objects.filter(user_profile=user_profile,
message__in=messages):
user_messages[user_message.message_id] = user_message
user_messages = dict((user_message.message_id, user_message) for user_message in
UserMessage.objects.filter(user_profile=user_profile,
message__in=messages))
message_list = []
for message in messages:
flags_dict = {'flags': ["read", "historical"]}