mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +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:
parent
8d238ce536
commit
7f722a6425
@ -484,11 +484,16 @@ def syncdb():
|
|||||||
# If we just installed the User model, ask about creating a superuser
|
# If we just installed the User model, ask about creating a superuser
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
if User in created_models:
|
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): "
|
"any superusers defined.\nWould you like to create one now? (yes/no): "
|
||||||
confirm = raw_input(msg)
|
confirm = raw_input(msg)
|
||||||
if confirm.lower().startswith('y'):
|
while 1:
|
||||||
createsuperuser()
|
if confirm not in ('yes', 'no'):
|
||||||
|
confirm = raw_input('Please enter either "yes" or "no": ')
|
||||||
|
continue
|
||||||
|
if confirm == 'yes':
|
||||||
|
createsuperuser()
|
||||||
|
break
|
||||||
|
|
||||||
syncdb.args = ''
|
syncdb.args = ''
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user