From c0f8aeb405f01f508cea8e04c4a7bc628ca31c00 Mon Sep 17 00:00:00 2001 From: vapao Date: Fri, 17 Jun 2022 14:46:59 +0800 Subject: [PATCH] =?UTF-8?q?U=20=E4=BC=98=E5=8C=96=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E8=A2=AB=E7=A6=81=E8=B4=A6=E6=88=B7=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/account/management/commands/user.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spug_api/apps/account/management/commands/user.py b/spug_api/apps/account/management/commands/user.py index 063794f..0d1be0f 100644 --- a/spug_api/apps/account/management/commands/user.py +++ b/spug_api/apps/account/management/commands/user.py @@ -52,10 +52,9 @@ class Command(BaseCommand): self.echo_error('缺少参数') self.print_help() user = User.objects.filter(username=options['u'], deleted_by_id__isnull=True).first() - if not user: - return self.echo_error(f'未找到登录名为【{options["u"]}】的账户') - user.is_active = True - user.save() + if user: + user.is_active = True + user.save() cache.delete(user.username) self.echo_success('账户已启用') elif action == 'reset':