Skip to content

bug-2028936: FieldError in Django admin for policy exceptions search field#7178

Merged
Haseeb702 merged 1 commit into
mainfrom
bug-2028936-field-error-django
Apr 6, 2026
Merged

bug-2028936: FieldError in Django admin for policy exceptions search field#7178
Haseeb702 merged 1 commit into
mainfrom
bug-2028936-field-error-django

Conversation

@Haseeb702
Copy link
Copy Markdown
Contributor

@Haseeb702 Haseeb702 commented Apr 2, 2026

Because:

  • The search field in Django admin page for policy exception reported a FieldError to Sentry

This PR:

  • Fixes the FieldError by changing the notes field in search_fields to a valid value in the PolicyException method, which in our case is comment

@Haseeb702 Haseeb702 requested a review from a team as a code owner April 2, 2026 17:12
Copy link
Copy Markdown
Contributor

@biancadanforth biancadanforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Straightforward enough!

A few notes:

Your PR description states that we need to set the value to a valid one from list_display, but this isn't correct. list_display controls what columns are displayed in the table, some of which aren't attributes on the PolicyException (e.g. get_user_email is a method on the PolicyExceptionAdmin class). The value needs to be set to a valid one from the set of attributes on the PolicyException. The Sentry error message indicates this: "Cannot resolve keyword 'notes' into field. Choices are: comment, created, id, user, user_id" (id is auto-generated).

Normally any change we make should have an accompanying test. Since this is an admin page, and there are currently no PolicyException tests FWICT (which may explain how this bug snuck in in the first place), I won't block on that.

@Haseeb702 Haseeb702 added this pull request to the merge queue Apr 6, 2026
Merged via the queue into main with commit 3ce540b Apr 6, 2026
1 check passed
@Haseeb702 Haseeb702 deleted the bug-2028936-field-error-django branch April 6, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants