I\'m just a beginner, so i got some questions making my first project. I\'ve got code in views:
def signup(request):
if request.method == \'POST\':
form = Si
You can't use regexes like [0-9A-Za-z_\-]+
when you use path(). If you want to use regexes, then use re_path (which works the same as url()
from older versions of Django).
When you use path()
, you can use one of the built-in path converters. You can't use <int:uidb64>
, because uidb can contain A-Za-z
, hyphens, and underscores, not just digits.
For your uidb64
and token
, I think slug
is the most suitable of the path converters included in Django.
path('activate/<slug:uidb64>/<slug:token>/', views.activate, name='activate'),
This will match slugs and tokens which your regex wouldn't allow, but this isn't a problem as long as your check_token
method returns False
for these invalid values and does not raise an error.