diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 5aab1d255b7..b718e5b886d 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -1590,7 +1590,6 @@ def get_sent_kudos(self): contract__network=settings.KUDOS_NETWORK, ).distinct('id') - @property def is_org(self): try: diff --git a/app/dashboard/views.py b/app/dashboard/views.py index b2713f61ab4..01027a3e570 100644 --- a/app/dashboard/views.py +++ b/app/dashboard/views.py @@ -1202,22 +1202,25 @@ def profile(request, handle): @csrf_exempt def lazy_load_kudos(request): page = request.POST.get('page', 1) - address = request.POST.get('address') context = {} datarequest = request.POST.get('request') order_by = request.GET.get('order_by', '-modified_on') limit = int(request.GET.get('limit', 8)) handle = request.POST.get('handle') - profile = Profile.objects.get(handle=handle) - if datarequest == 'mykudos': - key = 'kudos' - context[key] = profile.get_my_kudos.order_by('id', order_by) - else: - key = 'sent_kudos' - context[key] = profile.get_sent_kudos.order_by('id', order_by) - paginator = Paginator(context[key], limit) + if handle: + try: + profile = Profile.objects.get(handle=handle) + if datarequest == 'mykudos': + key = 'kudos' + context[key] = profile.get_my_kudos.order_by('id', order_by) + else: + key = 'sent_kudos' + context[key] = profile.get_sent_kudos.order_by('id', order_by) + except Profile.DoesNotExist: + pass + paginator = Paginator(context[key], limit) kudos = paginator.get_page(page) kudos_html = loader.render_to_string('shared/kudos_card_profile.html', {'kudos': kudos}) return JsonResponse({'kudos_html': kudos_html, 'has_next': kudos.has_next()})