Merge pull request #2 from QingdaoU/master

初始化管理员用户的时候,由判断 root 用户名是否存在改为是否有用户存在
This commit is contained in:
shaohuihuang 2018-12-11 21:58:15 +08:00 committed by GitHub
commit 35bf94c796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,7 @@ class Command(BaseCommand):
exit(1)
if action == "create_super_admin":
if User.objects.filter(username=username).exists():
if User.objects.filter(id=1).exists():
self.stdout.write(self.style.SUCCESS(f"User {username} exists, operation ignored"))
exit()