Opened 19 years ago

Closed 19 years ago

#597 closed defect (worksforme)

django-admin.py createsuperuser (MySQL) broken

Reported by: stava@… Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: major Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The "django-admin.py createsuperuser" using MySQL seems to be broken (recently, in revision 797).

da createsuperuser
Username (only letters, digits and underscores): stava
E-mail address: stava@jonitec.se
Password: 
Password (again): 
Traceback (most recent call last):
  File "/usr/bin/da", line 130, in ?
    main()
  File "/usr/bin/da", line 75, in main
    ACTION_MAPPING[action]()
  File "/usr/lib/python2.3/site-packages/django/core/management.py", line 444, in createsuperuser
    u = users.create_user(username, email, password)
  File "/usr/lib/python2.3/site-packages/django/models/auth.py", line 163, in _module_create_user
    user.save()
  File "/usr/lib/python2.3/site-packages/django/utils/functional.py", line 3, in _curried
    return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items()))
  File "/usr/lib/python2.3/site-packages/django/core/meta/__init__.py", line 799, in method_save
    db_values = [f.get_db_prep_save(f.pre_save(getattr(self, f.column), True)) for f in opts.fields if not isinstance(f, AutoField)]
  File "/usr/lib/python2.3/site-packages/django/core/meta/fields.py", line 340, in get_db_prep_save
    value = value.replace(microsecond=0)
TypeError: replace() takes no keyword arguments

Further investigation reveals that the SQL statement is also incorrect:

INSERT INTO auth_users (date_joined, last_login, is_superuser, is_active,
    is_staff, password_md5, email, last_name, first_name, username)
  VALUES
    (username, , , email, passwd, False, True, False,
     2005-10-07 02:10:25.732343, 2005-10-07 02:10:25.732343)'

The list of field names and the list of values does not correlate.

Change History (2)

comment:1 by Sune Kirkeby <sune.kirkeby@…>, 19 years ago

Ok, I just tested, and it works here (rev. 851).

sune@moria ~/svk/django/trunk $ django-admin.py init
sune@moria ~/svk/django/trunk $ django-admin.py createsuperuser
Username (only letters, digits and underscores): sune
E-mail address: sune.kirkeby@gmail.com
Password: 
Password (again): 
User created successfully.

And, where did you grap that SQL? It's all kinds of botched...

comment:2 by Adrian Holovaty, 19 years ago

Resolution: worksforme
Status: newclosed

Works here, too. I'm closing the ticket.

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