Standard authorization from the Django documentation, but an error occurs in the line calling the login () function
Exception Type: TypeError Exception Value: 'str' object is not callable view.py:
from django.contrib.auth import authenticate, login, logout def auth(request): login = request.POST.get("login", "") password = request.POST.get("password", "") user = authenticate(username=login, password=password) if user is not None: if user.is_active: login(request, user) return redirect('/') else: # Return a 'disabled account' error message print('disabled account') else: # Return an 'invalid login' error message. print('invalid login') The authenticate () function works fine, the user is. Please tell me what could be the problem?