There is a problem with your code.
you have a class with login
name(class login(View)
), also you have imported
from django.contrib.auth import login
These two have a conflict with each other, change your class name to Login
(capital L
) or something else to not override the django
login.