From ccf4f401ee02554ef025f807fcd8664afe5054ae Mon Sep 17 00:00:00 2001 From: Mark Beacom Date: Sat, 10 Feb 2018 13:44:20 -0500 Subject: [PATCH] Temporarily hack fix #386 --- app/dashboard/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/dashboard/views.py b/app/dashboard/views.py index 1594aebb31b..017dd262ee3 100644 --- a/app/dashboard/views.py +++ b/app/dashboard/views.py @@ -468,6 +468,12 @@ def profile_helper(handle): profile = Profile.objects.get(handle__iexact=handle) except Profile.DoesNotExist: raise Http404 + except Profile.MultipleObjectsReturned as e: + # Handle edge case where multiple Profile objects exist for the same handle. + # We should consider setting Profile.handle to unique. + # TODO: Should we handle merging or removing duplicate profiles? + profile = Profile.objects.filter(handle__iexact=handle).latest('id') + logging.error(e) return profile