I´ve been looking for ways to authenticate an user without password in Django, but that is not my doubt.
I´ve seen this answer which has 24 upvotes. The answer says I have do that in my views.py:
user = authenticate(username=user.username)
login(request, user)
When I execute the code, I´m getting this error: UnboundLocalError: local variable 'user' referenced before assignment
. This is obvious for me, I´m defining a variable using that variable.
So, why does the answer have 24 upvotes if it isn´t working? What do I have to do to get above code working?
Django version: 2.1