我正在使用PasswordResetView (Django2.0中基于类的视图)在我的应用程序中实现忘记密码功能。我是第一次接触基于类的视图,默认情况下,它会在我的用户模型中查找is_active。但是,我覆盖了默认的用户模型,我的模型包含名为active的字段。如何更改此行为?
FieldError at /account/reset-Password/
Cannot resolve keyword 'is_active' into field. Choices are: active, admin, confirm, email, full_name, id, last_login, logentry, password, social_auth, staff, timestamp, userlogin, username
Request Method: POST
Request URL: http://127.0.0.1:8000/account/reset-Password/
Django Version: 2.0.5
Exception Type: FieldError
Exception Value:
Cannot resolve keyword 'is_active' into field. Choices are: active, admin, confirm, email, full_name, id, last_login, logentry, password, social_auth, staff, timestamp, userlogin, username
Exception Location: /home/yash/Desktop/ltigo/lib/python3.6/site-packages/django/db/models/sql/query.py in names_to_path, line 1379
Python Executable: /home/yash/Desktop/ltigo/bin/python
Python Version: 3.6.5
Python Path:
['/home/yash/Desktop/ltigo/src',
'/home/yash/Desktop/ltigo',
'/home/yash/Desktop/ltigo/lib/python36.zip',
'/home/yash/Desktop/ltigo/lib/python3.6',
'/home/yash/Desktop/ltigo/lib/python3.6/lib-dynload',
'/usr/lib/python3.6',
'/home/yash/Desktop/ltigo/lib/python3.6/site-packages',
'/snap/pycharm-professional/68/helpers/pycharm_matplotlib_backend']
Server time: Mon, 16 Jul 2018 15:18:07 +0000https://stackoverflow.com/questions/51365273
复制相似问题