0
Djangoの新機能です。Django-registration-redux:get_success_url()は1つの位置引数をとりますが、2が与えられました
私はタンゴをDjangoに追いかけてきたので、このエラーが起こっているのに驚いています。私はthis answerをチェックし、それは次のようになりますように、私のRegistrationViewを変更:私はまだ同じエラーを取得していますが
class MyRegistrationView(RegistrationView):
success_url = 'home'
。ユーザーは登録されますが、以下のスタックトレースが表示されます。
全urls.py:
from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib import admin
from registration.backends.simple.views import RegistrationView
from jam import views
class MyRegistrationView(RegistrationView):
success_url = 'home'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^jam/', include('jam.urls')),
url(r'^admin/', admin.site.urls),
url(r'^accounts/', include('registration.backends.simple.urls')),
url(r'^accounts/register/$', MyRegistrationView.as_view(), name="registration_register"),
url(r'^accounts/password/change/$', MyRegistrationView.as_view(), name="auth_password_change"),
url(r'^accounts/password/change/done/$', MyRegistrationView.as_view(), name="auth_password_changed"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
登録フォーム:
{% extends "base.html" %}
{% load staticfiles %}
{% block body_block %}
<link href="{% static 'css/signin.css' %}" rel="stylesheet">
<div class="container">
<div class="jumbotron">
<h1 class="display-3" align="center">Sign Up Here</h1>
</div>
<form method="POST" action=".">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" class="btn btn-default" value="Submit"/>
</form>
</div>
{% endblock %}
はい、私は移行しました。
のフルスタックトレース:
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/accounts/register/
Django Version: 1.10.2
Python Version: 3.5.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'haystack',
'jam',
'registration']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "g:\Python\lib\site-packages\django\core\handlers\exception.py" in inner
39. response = get_response(request)
File "g:\Python\lib\site-packages\django\core\handlers\base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "g:\Python\lib\site-packages\django\core\handlers\base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "g:\Python\lib\site-packages\django\views\generic\base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "g:\Python\lib\site-packages\registration\views.py" in dispatch
33. return super(RegistrationView, self).dispatch(*args, **kwargs)
File "g:\Python\lib\site-packages\django\views\generic\base.py" in dispatch
88. return handler(request, *args, **kwargs)
File "g:\Python\lib\site-packages\django\views\generic\edit.py" in post
183. return self.form_valid(form)
File "g:\Python\lib\site-packages\registration\views.py" in form_valid
37. success_url = self.get_success_url(new_user)
Exception Type: TypeError at /accounts/register/
Exception Value: get_success_url() takes 1 positional argument but 2 were given
質問に完全なエラートレースバックを追加できますか? @KlausD。 –
下に追加されました –
'django-registration-redux'のどのバージョンをインストールしましたか? –