Skip to content

Document or remove first_name / last_name as a search in the admin for custom users #509

Open
@silviogutierrez

Description

@silviogutierrez

If you use a custom user that does not include first_name / last_name as a field, searching in the admin will error out as actor__first_name and actor__last_name are not valid fields.

I can think of a few options:

  1. Unregister the admin using admin.site.unregister(LogEntry)
  2. Subclass LogEntryAdmin, override search_fields
  3. Register this new admin.

Or simply remove these fields from the built-in admin search_fields.

Or only add these to search if get_user_model + meta ensures they exist.

I generally avoid splitting up first name / last name these days, though I know Django defaults to this.

Let me know which option sounds reasonable and I'm happy to open a PR. Great project, saved me a lot of time. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions