`Cannot resolve keyword 'is_active' into field.`
As far as I can tell from the docs and code, Django requires `is_active`
to be present on the custom user model as an '''attribute''', not an
actual database field.
In my case, I have `is_active` defined as a property on the model that is
calculated from other information.
The filtering of active users should therefore be done in Python rather
than at the database-level. Instead of:
{{{#!python
active_users = UserModel._default_manager.filter(
email__iexact=email, is_active=True)
for user in active_users:
}}}
It should be something like:
{{{#!python
users = UserModel._default_manager.filter(email__iexact=email)
active_users = filter(lambda u: u.is_active, users)
for user in active_users:
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22192>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_docs: => 0
Comment:
Hi,
The documentation on custom user models and builtin auth forms [1] says:
> Assumes that the user model has [...] a boolean field named is_active to
prevent password resets for inactive users.
So I'd argue that things are working as intended.
There may be a case for making the form a bit more flexible when it comes
to custom user models (in fact, there's already some tickets regarding
this issue with other builtin auth forms I believe) so if you have some
ideas on how to improve things, feel free to open a new ticket describing
your proposal.
Thanks.
[1] https://docs.djangoproject.com/en/1.6/topics/auth/customizing/#custom-
users-and-the-built-in-auth-forms
--
Ticket URL: <https://code.djangoproject.com/ticket/22192#comment:1>