Update views_front.py

解决前台偶发500问题
This commit is contained in:
cococo 2023-12-06 18:32:20 +08:00 committed by GitHub
parent 5be3ce4bb2
commit 67967bbff9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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})
return render(request, 'show_work.html', {'single_info':single_info, 'all_info':all_info, 'u':u})