Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19725 closed Bug (fixed)

`createsuperuser` command fails with custom User model

Reported by: michisu Owned by: nobody
Component: contrib.auth Version: 1.5-beta-1
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

If using a custom User model with non-ascii field label, then createsuperuser command fails.

class MyUser(AbstractBaseUser):

    email = models.EmailField(
        u'メールアドレス', max_length=255, unique=True, db_index=True)
    # ...
$ python manage.py createsuperuser
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

Change History (6)

comment:1 by Claude Paroz, 12 years ago

Please run the command with the --traceback option so as we can see where's the issue.

comment:2 by michisu, 12 years ago

I ran the command with the --traceback option:

$ python manage.py createsuperuser --traceback
Traceback (most recent call last):
  File "/Users/michisu/VirtualEnvs/ppf/lib/python2.7/site-packages/django/core/management/base.py", line 222, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/michisu/VirtualEnvs/ppf/lib/python2.7/site-packages/django/core/management/base.py", line 255, in execute
    output = self.handle(*args, **options)
  File "/Users/michisu/VirtualEnvs/ppf/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 87, in handle
    raw_value = input(input_msg + ': ')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

comment:3 by Claude Paroz, 12 years ago

Easy pickings: set
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:4 by Claude Paroz <claude@…>, 12 years ago

Resolution: fixed
Status: newclosed

In 55c585f1c7a9c91308193f0648caf36203174564:

Fixed #19725 -- Made createsuperuser handle non-ascii prompts

Thanks Michisu for the report.

comment:5 by Claude Paroz <claude@…>, 12 years ago

In f5232597ea31bf274b02983f32ba89be4f7bf02b:

[1.5.x] Fixed #19725 -- Made createsuperuser handle non-ascii prompts

Thanks Michisu for the report.
Backport of 55c585f1c from master.

comment:6 by Claude Paroz <claude@…>, 12 years ago

In f5232597ea31bf274b02983f32ba89be4f7bf02b:

[1.5.x] Fixed #19725 -- Made createsuperuser handle non-ascii prompts

Thanks Michisu for the report.
Backport of 55c585f1c from master.

Note: See TracTickets for help on using tickets.
Back to Top