django-inspectional-registration を使用していますが、 RegistrationViewを拡張したいと考えています。
class RegistrationView(FormMixin, TemplateResponseMixin, ProcessFormView):
"""A complex view for registration
GET:
Display an RegistrationForm which has ``username``, ``email1`` and ``email2``
for registration.
``email1`` and ``email2`` should be equal to prepend typo.
``form`` and ``supplement_form`` is in context to display these form.
POST:
Register the user with passed ``username`` and ``email1``
"""
template_name = r'registration/registration_form.html'
def __init__(self, *args, **kwargs):
self.backend = get_backend()
super(RegistrationView, self).__init__(*args, **kwargs)
私は私の中で次のことをしましたviews.py
:
def extended_registration(request, *args, **kwargs):
k = 1+1
return RegistrationView(request, *args, **kwargs)
RegistrationView = extended_registration(RegistrationView)
作成されたものは機能しているようですが、次のようdecorator
になります。
Traceback:
File "/Users/my_environment/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
92. response = middleware_method(request)
File "/Users/my_environment/lib/python2.7/site-packages/django/utils/importlib.py" in import_module
35. __import__(name)
File "/Users/myProject/urls.py" in <module>
5. from myProject.views import *
File "/Users/myProject/views.py" in <module>
92. RegistrationView = extended_registration(RegistrationView)
File "/Users/myProject/views.py" in extended_registration
90. return RegistrationView(request, *args, **kwargs)
File "/Users/myProject/registration/views.py" in __init__
157. super(RegistrationView, self).__init__(*args, **kwargs)
Exception Type: TypeError at /accounts/register/complete/
Exception Value: __init__() takes exactly 1 argument (2 given)