首页 > 解决方案 > /accounts/register/get_success_url() 处的 Django 注册类型错误缺少 1 个必需的位置参数:“用户”

问题描述

在用户成功注册我的应用程序后,使用 Django 注册 redux 插件创建表单页面。但是,我TypeError at /accounts/register/ get_success_url() missing 1 required positional argument: 'user'在完成注册后一直收到此错误。它应该重定向到具有以下方法中显示的表单的页面

from registration.backends.simple.views import RegistrationView


# my new reg view, subclassing RegistrationView from our plugin
class MyRegistrationView(RegistrationView):
    def get_success_url(self, request, user):
        # the named URL that we want to redirect to after
        # successful registration
        return ('registration_create_word')

这是网址路径 path('accounts/create_word/', views.create_word, name='registration_create_word'),

我试图将参数更改为只是user我收到了相同的错误,但它丢失了self。不知道我错过了什么。我发现了一个类似的问题(How to redirect users to a specific url after registration in django registration?)但是我仍然收到错误

任何帮助将不胜感激。

标签: djangopython-3.xdjango-registration

解决方案


推荐阅读