Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change admin search_fields to favor USERNAME_FIELD instead of "email". #1428

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on May 25, 2024

  1. 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.
    charettes committed May 25, 2024
    Configuration menu
    Copy the full SHA
    0206587 View commit details
    Browse the repository at this point in the history