You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change admin search_fields to favor USERNAME_FIELD instead of "email".
First nothing guarantees that the user model has a field named "email" as it
can be set to a different name using `EMAIL_FIELD`. At the very least the
`get_email_field_name` should have been used.
Secondly nothing guarantees that `EMAIL_FIELD` is going to be indexed and thus
suitable for search purposes. On the other hand `USERNAME_FIELD` must be unique
and thus indexed to enforce the constraint and unique identifies users.
For these reasons `USERNAME_FIELD` represents a better choice to allow the
different toolkit models to be searched by through the admin.
0 commit comments