I am using PasswordResetView
(the class-based view in Django 2.0) to implement Forgot Password functionality into my app. I am new to class based views and by default it looks for is_active
in my user model. However, I overrode the default user model and my model instead contains the field with the name active
. How do I change this behavior?
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 +0000
To fix that particular error, it looks as if you have to subclass PasswordResetForm
so that it doesn't use is_active
. Then use your form in your password reset view.
However, I would recommend against renaming the field to active
- it is likely to cause problems in other places as well.