1

I am trying to integrate the django-sanction library on my small blog (I am a django beginner), but, when I set up the example as in the package, and then run syncdb, I get:

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

I guess the problem is with the user model defined in the package, but I am unsure how to get rid of this error.

I have tried adding an email field (since I think create_superuser() requires an email field to be passed), as follows:

class User(AbstractBaseUser):

    username = models.CharField(_('username'), max_length=30, unique=True)
    first_name = models.CharField(_('first name'), max_length=100, blank=True)
    last_name = models.CharField(_('last name'), max_length=100, blank=True)
    email = models.EmailField(verbose_name='email address', max_length=255, unique=True)
    USERNAME_FIELD = 'username'
    REQUIRED_FIELDS = ['email_address']
    ....

but this does not solve the error. I guess I probably explicitly need to pass the email field to the create_superuser() method (?). Any help as to how to solve this error would be greatly appreciated. Thanks.

4

1 回答 1

-2

好的 - 原来作者没有更新他的 repo - 现在超级用户创建没有任何问题。

于 2013-04-23T13:20:26.630 回答