1
0
mirror of https://github.com/django/django.git synced 2025-07-05 10:19:20 +00:00

magic-removal: Made 'Would you like to create a superuser' raw_input() more fault-tolerant in django/core/management.py

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2541 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-03-20 19:58:37 +00:00
parent 8d238ce536
commit 7f722a6425

View File

@ -484,11 +484,16 @@ def syncdb():
# If we just installed the User model, ask about creating a superuser
from django.contrib.auth.models import User
if User in created_models:
msg = "\nIt looks like you just installed Django's auth system which means you don't have " \
msg = "\nYou just installed Django's auth system, which means you don't have " \
"any superusers defined.\nWould you like to create one now? (yes/no): "
confirm = raw_input(msg)
if confirm.lower().startswith('y'):
createsuperuser()
while 1:
if confirm not in ('yes', 'no'):
confirm = raw_input('Please enter either "yes" or "no": ')
continue
if confirm == 'yes':
createsuperuser()
break
syncdb.args = ''