U 优化启用被禁账户命令

pull/509/head
vapao 2022-06-17 14:46:59 +08:00
parent 860048796d
commit c0f8aeb405
1 changed files with 3 additions and 4 deletions

View File

@ -52,8 +52,7 @@ 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"]}】的账户')
if user:
user.is_active = True
user.save()
cache.delete(user.username)