From 9c7d1fafe7d23ab74178770c2d2762e111fe5614 Mon Sep 17 00:00:00 2001 From: vapao Date: Wed, 15 Jul 2020 18:16:22 +0800 Subject: [PATCH] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=B4=A6=E6=88=B7=E5=8F=AF=E8=83=BD=E4=BC=9A=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E5=90=8C=E5=90=8D=E8=B4=A6=E6=88=B7=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/account/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spug_api/apps/account/views.py b/spug_api/apps/account/views.py index 6a4e43d..53ea371 100644 --- a/spug_api/apps/account/views.py +++ b/spug_api/apps/account/views.py @@ -50,6 +50,8 @@ class UserView(View): if form.get('password'): form.token_expired = 0 form.password_hash = User.make_password(form.pop('password')) + if User.objects.filter(username=form.username, deleted_by_id__isnull=True).exclude(id=form.id).exists(): + return json_response(error=f'已存在登录名为【{form.username}】的用户') User.objects.filter(pk=form.pop('id')).update(**form) return json_response(error=error)