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