Python 不一致的错误消息

Python 不一致的错误消息,python,django,django-registration,Python,Django,Django Registration,我使用django注册模块,但这是一个django/python问题 在自定义视图中: def register(self, request, **cleaned_data): firstname, lastname, email, password = cleaned_data['firstname'], cleaned_data['lastname'], cleaned_data['email'], cleaned_data['password'] if Site._met

我使用django注册模块,但这是一个django/python问题

在自定义视图中:

def register(self, request, **cleaned_data):

    firstname, lastname, email, password = cleaned_data['firstname'], cleaned_data['lastname'], cleaned_data['email'], cleaned_data['password']
    if Site._meta.installed:
        site = Site.objects.get_current()
    else:
        site = RequestSite(request)
    new_user = RegistrationProfile.objects.create_inactive_user(email, email,
                                                                password, firstname,
                                                                lastname, site)

    signals.user_registered.send(sender=self.__class__,
                                 user=new_user,
                                 request=request)
    return new_user
当我发送我的表单时,我得到以下错误:

TypeError at /accounts/register/
 create_inactive_user() takes at most 6 arguments (7 given)
指向我的创建非活动用户(电子邮件、电子邮件、密码、名字、姓氏、站点)。。。有6个论点


我尝试使用硬编码的值,但得到了相同的消息。

当调用方法时,
self
被隐式添加为第一个参数

你忘了在函数定义中包含
self
作为第一个参数吗?

根据判断,create方法不需要名字和姓氏参数-self将被隐式传递,但它希望你传递5个变量-用户名、电子邮件、密码、站点和可选的发送电子邮件


你给它的参数太多(而且不正确):)

这只对类方法有效。如果它不在类中,它就不是方法。好吧,我完全偏离了轨道。事实上,我定义了一个自定义的create\u inactive\u user()方法,但我没有正确调用它!很高兴你成功了!