2👍
✅
Use this:
<a href="{% url 'login:login' %}"><h3 class="agileinfo_sign">Sign In </h3></a>
Hope this small change will solve your problem.
0👍
In my case, it happened to me when I forgot to add the login_url = ‘view_name’ field of login_required() decorator.
before:
@login_required()
def checkout_page(request):
return render(request, 'checkout.html', context)
after:
@login_required(login_url='your_login_view_name')
def checkout_page(request):
return render(request, 'checkout.html', context)
I hope this can help someone who wants only authenticated users can access the checkout page.
- [Django]-Django Global function and variable
- [Django]-How to use Django with Svelte?
- [Django]-Pylint doesn't report wrong import order when using Django
- [Django]-Model_to_dict is not returning DateTimeField with auto_now_add = True
0👍
I got the same error below:
django.urls.exceptions.NoReverseMatch: Reverse for ‘/account/two_factor/setup/’ not found. ‘/account/two_factor/setup/’ is not a valid view function or pattern name.
Because I set a normal URL to url tag instead of a URL namespace as shown below:
<a href="{% url '/account/two_factor/setup/' %}">Two factor setup</a>
So, I set a URL namespace to url
tag as shown below, then the error was solved:
<a href="{% url '/account/two_factor/setup/' %}">Two factor setup</a>
Or, I set a normal URL to href attribute as shown below, then the error was solved:
<a href="/account/two_factor/setup/">Two factor setup</a>
- [Django]-Django annotation in a loop
- [Django]-Django/Python convert string to Model filter with '=' in result
- [Django]-Django tests with selenium not loading fixtures
- [Django]-Serializer field validation and how to check if value exist?
Source:stackexchange.com