Des*_*023 15 python django django-users
I setup if statement to see if the current user has a password set. For some reason it just won't work. I have tried:
{% if not user.password %}
{% if user.password == None %}
{% if user.password is None %}
Run Code Online (Sandbox Code Playgroud)
I have 2 user accounts (different browsers open), one with a password in one, and one without in the other. When I use the statements above I get the same showing in both browsers. What am I doing wrong?
fal*_*tru 34
>>> a = User.objects.create_user('user1', 'user1@example.com')
>>> b = User.objects.create_user('user2', 'user2@example.com', password='secret')
>>> a.has_usable_password()
False
>>> b.has_usable_password()
True
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4398 次 |
| 最近记录: |