From 565acffbc59970532f5a113d59bb5fe92b995cd5 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 11 Dec 2012 16:48:36 -0500 Subject: [PATCH] Fix populate_db pointer restore. (imported from commit e7984f5a762fde833c3b8520ef556fbd841aacbb) --- zephyr/management/commands/populate_db.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zephyr/management/commands/populate_db.py b/zephyr/management/commands/populate_db.py index 1c695f3c7a..54bff5d726 100644 --- a/zephyr/management/commands/populate_db.py +++ b/zephyr/management/commands/populate_db.py @@ -610,9 +610,10 @@ def restore_saved_messages(): # Set restored pointers to the very latest messages with transaction.commit_on_success(): - for up in UserProfile.objects.all(): + for user_profile in UserProfile.objects.all(): try: - top = UserMessage.objects.filter(user_profile_id=up.id).order_by("-message")[0] + top = UserMessage.objects.filter( + user_profile_id=user_profile.id).order_by("-message")[0] user_profile.pointer = top.message_id except IndexError: user_profile.pointer = -1