mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-12-28 16:12:13 +00:00
修复误删用户问题
This commit is contained in:
parent
a87d73393d
commit
4e80ac9492
@ -120,8 +120,7 @@ class UserAdminAPI(APIView):
|
||||
user = User.objects.get(id=user_id)
|
||||
except User.DoesNotExist:
|
||||
return f"User {user_id} does not exist"
|
||||
profile = user.userprofile
|
||||
if profile.submission_number:
|
||||
if Submission.objects.filter(user_id=user_id).exists():
|
||||
return f"Can't delete the user {user_id} as he/she has submissions"
|
||||
user.delete()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user