Skip to content

Related Field got invalid lookup: icontains #185

@harsha09

Description

@harsha09

This is occurring when I tried searching in Django admin for Revisions. This is due to https://github.com/jedie/django-reversion-compare/blob/master/reversion_compare/admin.py#L271, as the user field is a FK to the User table. The search fields should refer to the exact field in the table instead of a FK.

For example: user__name or user__email.

Request Method: | GET
-- | --
http://localhost:8000/myapp/reversion/revision/?q=sdfs
3.2.16
FieldError
Related Field got invalid lookup: icontains
/Users//.venv/lib/python3.10/site-packages/django/db/models/sql/query.py, line 1207, in build_lookup
/Users//.venv/bin/python
3.10.5

Django version: 3.2.16
django-reversion: 5.0.4
django-reversion-compare: 0.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions