From 15d355d79dc26fb150776e6e019b2f667e4cb2ff Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Sat, 29 Sep 2012 11:14:16 +0800 Subject: [PATCH] Fixed #19041 -- Corrected the handling of default usernames in createsuperuser. --- django/contrib/auth/management/commands/createsuperuser.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/django/contrib/auth/management/commands/createsuperuser.py b/django/contrib/auth/management/commands/createsuperuser.py index c5f6469548..8130b326c5 100644 --- a/django/contrib/auth/management/commands/createsuperuser.py +++ b/django/contrib/auth/management/commands/createsuperuser.py @@ -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: