开发者

Extending Django-Registration: Getting error on setting url.py

am trying to follow the answers provided in Django-Registration & Django-Profile, using your own custom form and Creating a Django Registration Form by Extending Django-Registation Application to extend the django-registration form. I added the following code in url.py

url(r'^accounts/register/$', register, {'backend': 'registration.backends.default.DefaultBackend','form_class': UserRegistrationForm}, name='registration_register'),
(r'^accounts/', include(regUrls)),

but now whenever i access http://localhost:8000/accounts/register/ am getting the following error开发者_如何学Python

register() got an unexpected keyword argument 'form_class'

Please help me out. Why am i getting this error? I goggled a lot but still i could not figure out a solution.


That dictionary in your urls.py entry gets passed as keyword arguments to the view function, register, when you access the page. register doesn't have a keyword argument form_class.

If the register your first link is referring to is the register from the second, the first link is wrong. Because that register doesn't accept that keyword arg. One answer seems to define a different register method, but I think that might be something else(?)

If you understand what the form_class is supposed to be passed to, you could just add the kwarg to register manually too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜