Fixed #19041 -- Corrected the handling of default usernames in createsuperuser.

This commit is contained in:
Russell Keith-Magee 2012-09-29 11:14:16 +08:00
parent fea0ca4334
commit 15d355d79d
1 changed files with 3 additions and 2 deletions

View File

@ -78,10 +78,11 @@ class Command(BaseCommand):
if not username:
input_msg = capfirst(username_field.verbose_name)
if default_username:
input_msg += ' (leave blank to use %r)' % default_username
input_msg += " (leave blank to use '%s')" % default_username
raw_value = input(input_msg + ': ')
if default_username and raw_value == '':
username = default_username
raw_value = default_username
try:
username = username_field.clean(raw_value, None)
except exceptions.ValidationError as e: