Skip to content

Commit

Permalink
Fixed #19041 -- Corrected the handling of default usernames in create…
Browse files Browse the repository at this point in the history
…superuser.
  • Loading branch information
freakboy3742 committed Sep 29, 2012
1 parent fea0ca4 commit 15d355d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions django/contrib/auth/management/commands/createsuperuser.py
Expand Up @@ -78,10 +78,11 @@ def handle(self, *args, **options):
if not username: if not username:
input_msg = capfirst(username_field.verbose_name) input_msg = capfirst(username_field.verbose_name)
if default_username: 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 + ': ') raw_value = input(input_msg + ': ')

if default_username and raw_value == '': if default_username and raw_value == '':
username = default_username raw_value = default_username
try: try:
username = username_field.clean(raw_value, None) username = username_field.clean(raw_value, None)
except exceptions.ValidationError as e: except exceptions.ValidationError as e:
Expand Down

0 comments on commit 15d355d

Please sign in to comment.