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.
π€Platinum Azure
1π
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
π€jdi
- [Answered ]-Django with Ajax and jQuery
- [Answered ]-Confused with virtual environments in python django
- [Answered ]-Submitting a django form via django-rest-framework and angularjs
- [Answered ]-Rendering template variables?
- [Answered ]-Django 1.7 long migrations never ends
Source:stackexchange.com