  Management utility to create superusers.
  """
  
  import getpass
  import os
  import re
  import sys
  from optparse import make_option
  from django.contrib.auth.models import User
  from django.core import exceptions
 
</s> remove             import pwd
            default_username = pwd.getpwuid(os.getuid())[0].replace(' ', '').lower()
 </s> add             default_username = getpass.getuser().replace(' ', '').lower() </s> remove             # KeyError will be raised by getpwuid() if there is no
            # corresponding entry in the /etc/passwd file (a very restricted
            # chroot environment, for example).
 </s> add             # KeyError will be raised by os.getpwuid() (called by getuser())
            # if there is no corresponding entry in the /etc/passwd file
            # (a very restricted chroot environment, for example). </s> remove             help='Tells Django to NOT prompt the user for input of any kind. '    \
                 'You must use --username and --email with --noinput, and '      \
                 'superusers created with --noinput will not be able to log in '  \
                 'until they\'re given a valid password.'),
 </s> add             help=('Tells Django to NOT prompt the user for input of any kind. '
                  'You must use --username and --email with --noinput, and '
                  'superusers created with --noinput will not be able to log '
                  'in until they\'re given a valid password.')),
  Management utility to create superusers.
  """
  
  import getpass

  import re
  import sys
  from optparse import make_option
  from django.contrib.auth.models import User
  from django.core import exceptions
keep keep keep keep replace keep keep keep keep keep
 Fixed #7077 and #7431 -- Use getpass.getuser instead of pwd.getpwuid to determine the current system user's username in the createsuperuser management command to enable the feature on Windows. getpass.getuser automatically falls back to the previous method.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14607 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/contrib/auth/management/commands/createsuperuser.py