initadmin for dev

This commit is contained in:
virusdefender 2017-01-23 16:36:22 +08:00
parent c26ee6e87a
commit cfde5b93e5

View File

@ -12,9 +12,9 @@ class Command(BaseCommand):
"would you like to reset it's password?\n" "would you like to reset it's password?\n"
"Input yes to confirm: ")) "Input yes to confirm: "))
if input() == "yes": if input() == "yes":
rand_password = rand_str(length=6) # for dev
# admin.set_password(rand_password) # rand_password = rand_str(length=6)
admin.set_password("rootroot") rand_password = "rootroot"
admin.save() admin.save()
self.stdout.write(self.style.SUCCESS("Successfully created super admin user password.\n" self.stdout.write(self.style.SUCCESS("Successfully created super admin user password.\n"
"Username: root\nPassword: %s\n" "Username: root\nPassword: %s\n"
@ -26,10 +26,10 @@ class Command(BaseCommand):
self.stdout.write(self.style.ERROR("User 'root' is not super admin.")) self.stdout.write(self.style.ERROR("User 'root' is not super admin."))
except User.DoesNotExist: except User.DoesNotExist:
user = User.objects.create(username="root", email="root@oj.com", admin_type=AdminType.SUPER_ADMIN) user = User.objects.create(username="root", email="root@oj.com", admin_type=AdminType.SUPER_ADMIN)
rand_password = rand_str(length=6)
# user.set_password(rand_password)
# for dev # for dev
user.set_password("rootroot") # rand_password = rand_str(length=6)
rand_password = "rootroot"
user.set_password(rand_password)
user.save() user.save()
UserProfile.objects.create(user=user) UserProfile.objects.create(user=user)
self.stdout.write(self.style.SUCCESS("Successfully created super admin user.\n" self.stdout.write(self.style.SUCCESS("Successfully created super admin user.\n"