Opened 6 years ago

Closed 6 years ago

#29666 closed Bug (needsinfo)

TypeError: create_superuser() takes exactly 4 arguments (3 given)

Reported by: bw2 Owned by: Jeff
Component: contrib.auth Version: 2.1
Severity: Normal 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 (last modified by bw2)

Running

 echo 'bla' | python -u manage.py createsuperuser --username test --email test

prints

Superuser creation skipped due to not running in a TTY. You can run `manage.py createsuperuser` in your project to create 

as expected, but then also raises this error:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/weisburd/Library/Python/2.7/lib/python/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/Users/weisburd/Library/Python/2.7/lib/python/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/weisburd/Library/Python/2.7/lib/python/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/weisburd/Library/Python/2.7/lib/python/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 63, in execute
    return super(Command, self).execute(*args, **options)
  File "/Users/weisburd/Library/Python/2.7/lib/python/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/Users/weisburd/Library/Python/2.7/lib/python/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 183, in handle
    self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
TypeError: create_superuser() takes exactly 4 arguments (3 given)

Change History (6)

comment:1 by bw2, 6 years ago

Description: modified (diff)

comment:2 by Jeff, 6 years ago

Owner: changed from nobody to Jeff
Status: newassigned

I'll look at this

comment:3 by Jeff, 6 years ago

I got the same TTY exception running this in my terminal, but did not receive the second error. Could you provide some more information on your system, where you ran the command, and copy paste the I/O for me?

comment:4 by Ramiro Morales, 6 years ago

It's strange the issue was opened against version 2.1 but the traceback shows things running under Python 2.7.

comment:5 by Jeff, 6 years ago

very true. I ran with python3 on master and saw no sign of the TypeError. Starting to sound like this may not be a real issue. bw2, can you confirm you were using python2.7 and on version 2.1?

comment:6 by Tim Graham, 6 years ago

Component: Uncategorizedcontrib.auth
Resolution: needsinfo
Status: assignedclosed
Type: UncategorizedBug

I couldn't reproduce on Django 1.11. Maybe a custom user model and an incorrectly written user manager is the cause?

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