Typeerror At /confirmemail/amlqctnhel/confirmemail() Takes Exactly 2 Arguments (1 Given), Why?
Error: TypeError at /confirmemail/amlqctnhel/ confirmemail() takes exactly 2 arguments (1 given) Request Method: GET Request URL: http://127.0.0.1:8000/confirmemail/amlqct
Solution 1:
In a URLconf, you need to use capturing groups in your regex to achieve positional or keyword arguments in your view. If you use a named capture group, then keyword arguments are used; otherwise, positional arguments are used.
Here is what your url()
line should look like:
url(r'^confirmemail/([a-zA-Z0-9]{10})/$', 'blog.views.confirmemail'),
# or
url(r'^confirmemail/(?P<token>[a-zA-Z0-9]{10})/$', 'blog.views.confirmemail'),
The first form uses a positional argument (and positional arguments are ordered by the capture groups in the URL). The second form uses a keyword argument, in this case token
. The second form is more characters but will also be safe against parameter reordering.
Solution 2:
You arent capturing a pattern in your url so its not passing a value for your token parameter
url(r'^confirmemail/([a-zA-Z0-9]{10})/$', 'blog.views.confirmemail'),
Note i have wrapped your pattern in a capture group
Post a Comment for "Typeerror At /confirmemail/amlqctnhel/confirmemail() Takes Exactly 2 Arguments (1 Given), Why?"