Sunday 15 March 2015

python - Checking if a Django user has a password set -


If I set up to see the statement that the current user has set the password or not For some reason this will not work just because I have tried:

  {% if user.password%} {% if user.password == none%} {% if user.password no Is not}}   

I have 2 user accounts (different browsers open), one of which has a password, and without each other When I use the above statements, I see the same in both browsers. What am i doing

use

  & gt; & Gt; & Gt; A = User.objects.create_user ('user1', 'user1@example.com') & gt; & Gt; & Gt; B = User.objects.create_user ('user2', 'user2@example.com', password = 'secret') & gt; & Gt; & Gt; A.has_usable_password () False & gt; & Gt; & Gt; B.has_usable_password () is true    

No comments:

Post a Comment