From bdf3473baceaa719f8cf6b77ace8f36cc050ccdd Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Tue, 20 Nov 2012 14:03:08 -0500 Subject: [PATCH] Fix bug where sending a PM would display as sent to the wrong person. In get_display_recipient, the userprofile was selected incorrectly by user_id instead of the userprofile_id. In production, this hasn't resulted in a user-visible error because we use MySQL and user ids are always equal to userprofile ids. This does happen if you are using SQLite locally and run populate_db, which adds a bunch of users in parallel in an insufficiently transactional way. (imported from commit c25a04b4919e3efdfc6996b03492f7714d9034e8) --- zephyr/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zephyr/models.py b/zephyr/models.py index ea45ab90e6..60eb8835f7 100644 --- a/zephyr/models.py +++ b/zephyr/models.py @@ -42,7 +42,7 @@ def get_display_recipient(recipient): 'full_name': user_profile.full_name, 'short_name': user_profile.short_name} for user_profile in user_profile_list] else: - user_profile = UserProfile.objects.select_related().get(user=recipient.type_id) + user_profile = UserProfile.objects.select_related().get(id=recipient.type_id) return {'email': user_profile.user.email, 'full_name': user_profile.full_name, 'short_name': user_profile.short_name}