From b7c33ea803edec61d245f9bd368189fc5f5d30d3 Mon Sep 17 00:00:00 2001 From: vapao Date: Fri, 15 May 2020 18:48:04 +0800 Subject: [PATCH] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E4=BC=9A=E5=87=BA=E7=8E=B0=E5=90=8C=E5=90=8D=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=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 823d31a..ef5a949 100644 --- a/spug_api/apps/account/views.py +++ b/spug_api/apps/account/views.py @@ -30,6 +30,8 @@ class UserView(View): Argument('role_id', type=int, help='请选择角色'), ).parse(request.body) if error is None: + if User.objects.filter(username=form.username, deleted_by_id__isnull=True).exists(): + return json_response(error=f'已存在登录名为【{form.username}】的用户') form.password_hash = User.make_password(form.pop('password')) form.created_by = request.user User.objects.create(**form)