Ticket #19745: 19745.diff

File 19745.diff, 1.8 KB (added by Preston Holmes, 12 years ago)

This patch fixes the symptoms - not sure how to test yet as I'm not sure what part of the current tests were resolving the lazy object in the output before - not sure.

  • django/contrib/auth/management/commands/createsuperuser.py

    diff --git a/django/contrib/auth/management/commands/createsuperuser.py b/django/contrib/auth/management/commands/createsuperuser.py
    index 4169da2..ce483de 100644
    a b from django.contrib.auth.management import get_default_username  
    1111from django.core import exceptions
    1212from django.core.management.base import BaseCommand, CommandError
    1313from django.db import DEFAULT_DB_ALIAS
    14 from django.utils.encoding import force_str
     14from django.utils.encoding import force_str, force_text
    1515from django.utils.six.moves import input
    1616from django.utils.text import capfirst
    1717
    class Command(BaseCommand):  
    8282                # Get a username
    8383                while username is None:
    8484                    if not username:
    85                         input_msg = capfirst(self.username_field.verbose_name)
     85                        input_msg = force_text(capfirst(self.username_field.verbose_name))
    8686                        if default_username:
    8787                            input_msg = "%s (leave blank to use '%s')" % (
    8888                                input_msg, default_username)
    class Command(BaseCommand):  
    109109                    field = self.UserModel._meta.get_field(field_name)
    110110                    user_data[field_name] = options.get(field_name)
    111111                    while user_data[field_name] is None:
    112                         raw_value = input(force_str('%s: ' % capfirst(field.verbose_name)))
     112                        raw_value = input('%s: ' % force_text(capfirst(field.verbose_name)))
    113113                        try:
    114114                            user_data[field_name] = field.clean(raw_value, None)
    115115                        except exceptions.ValidationError as e:
Back to Top