Here is my view,
def login_view(request) :
if request.method == 'POST':
form = LoginForm(request.POST)
if form.is_valid():
email = form.cleaned_data['email']
password = form.cleaned_data['password']
user = authenticate(email=email, password=password)
if user is not None:
form = LoginForm()
login(request, user)
I get an error:
login() missing 1 required positional argument: 'user'
Also, I am using a custom user model
My urls.py
:
urlpatterns = [
path('',views.register, name='register' ),
path('form',views.form, name = 'form'),
path('login',views.login, name = 'login ')]
You're not using the right view, try this instead
path('login',views.login_view, name = 'login ')