diff --git a/api/views_front.py b/api/views_front.py index 8b40d14..9eb2367 100644 --- a/api/views_front.py +++ b/api/views_front.py @@ -186,8 +186,9 @@ def get_all_info(): for peer in peers: user = UserProfile.objects.filter(Q(id=peer.uid)).first() - devices[peer.rid]['rust_user'] = user.username - + device = devices.get(peer.rid, None) + if device: + devices['rust_user'] = user.username return [v for k,v in devices.items()] @@ -203,4 +204,4 @@ def work(request): all_info = get_all_info() print(all_info) - return render(request, 'show_work.html', {'single_info':single_info, 'all_info':all_info, 'u':u}) \ No newline at end of file + return render(request, 'show_work.html', {'single_info':single_info, 'all_info':all_info, 'u':u})