I have urls.py :
urlpatterns = [ url(r'^$', views.index, {'check': False}), ] There is view.py :
def index(request, check=False): if check: return HttpResponse("Hello, world. You're at the test index.") else: return HttpResponseRedirect(reverse('autorisation:check_auth')) The index method uses the parameter check - whether the user is authorized or not. The idea is this: when you first enter the page, the parameter is False and, based on this, it throws a request for authorization. Authorization should return to the same index method, but with check = True .
Redirect from check_auth method (not working):
def check_auth(request): return redirect('app_test:index', check=True) How to implement this venture? It is advisable not to change views.py - without url parameters.
Mistake:
NoReverseMatch at /auth/check_auth Reverse for 'index' with arguments '()' and keyword arguments '{'check': True}' not found. 0 pattern(s) tried: []