createsuperuser with a custom User model

3,383 views
Skip to first unread message

mack the finger

unread,
Feb 10, 2013, 6:48:53 PM2/10/13
to django...@googlegroups.com
I created a custom User model. It has a few extra fields, most notably a "date_of_birth" field. Now when I try to crete a new superuser instance via the management command, I get this error:

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

My "create_superuser" manager method looks like this:

    def create_superuser(self, email, date_of_birth, password):
        u = self.create_user(email, date_of_birth, password)
        u.superuser = True
        u.save()
        return u

The management command isn't asking for the dob... Is this a known shortcoming of the new custom User model, or am I not doing something right?

Russell Keith-Magee

unread,
Feb 10, 2013, 7:04:59 PM2/10/13
to django...@googlegroups.com
If the management command isn't asking for the date of birth, then it sounds like you haven't put the DOB field in the list of REQUIRED_FIELDS. 


The other possibility is that you're not using a pre-release version of Django 1.5. Custom user models are a new feature, and aren't available in Django 1.4; you have to use the 1.5 release candidate or a version from git to get this feature.

Yours,
Russ Magee %-)

mack the finger

unread,
Feb 10, 2013, 8:03:29 PM2/10/13
to django...@googlegroups.com
Ah, I didn't add my fields to REQUIRED_FIELDS, thanks. I was thinking createsuperuser would look at the fields I had included in create_superuser's signature...
Reply all
Reply to author
Forward
0 new messages