Closed Bug 2028936 Opened 20 days ago Closed 13 days ago

FieldError in django admin search field

Categories

(Socorro :: Webapp, defect)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: hafzal, Assigned: hafzal)

References

Details

(Whiteboard: [cringe])

Attachments

(1 file)

A FieldError for Socorro was reported to Sentry, which was triggered by using the search field in the Django admin page for policy exceptions.

Assignee: nobody → hafzal
Whiteboard: [cringe]

https://mozilla.sentry.io/issues/7382639720

message:
FieldError: Cannot resolve keyword 'notes' into field. Choices are: comment, created, id, user, user_id

traceback:

  File "django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "django/contrib/admin/options.py", line 719, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "django/utils/decorators.py", line 192, in _view_wrapper
    result = _process_exception(request, e)
  File "django/utils/decorators.py", line 190, in _view_wrapper
    response = view_func(request, *args, **kwargs)
  File "django/views/decorators/cache.py", line 80, in _view_wrapper
    response = view_func(request, *args, **kwargs)
  File "django/contrib/admin/sites.py", line 246, in inner
    return view(request, *args, **kwargs)
  File "django/utils/decorators.py", line 48, in _wrapper
    return bound_method(*args, **kwargs)
  File "django/utils/decorators.py", line 192, in _view_wrapper
    result = _process_exception(request, e)
  File "django/utils/decorators.py", line 190, in _view_wrapper
    response = view_func(request, *args, **kwargs)
  File "django/contrib/admin/options.py", line 2024, in changelist_view
    cl = self.get_changelist_instance(request)
  File "django/contrib/admin/options.py", line 867, in get_changelist_instance
    return ChangeList(
  File "django/contrib/admin/views/main.py", line 145, in __init__
    self.queryset = self.get_queryset(request)
  File "django/contrib/admin/views/main.py", line 583, in get_queryset
    qs, search_may_have_duplicates = self.model_admin.get_search_results(
  File "django/contrib/admin/options.py", line 1242, in get_search_results
    queryset = queryset.filter(models.Q.create(term_queries))
  File "django/db/models/query.py", line 1495, in filter
    return self._filter_or_exclude(False, args, kwargs)
  File "django/db/models/query.py", line 1513, in _filter_or_exclude
    clone._filter_or_exclude_inplace(negate, args, kwargs)
  File "django/db/models/query.py", line 1523, in _filter_or_exclude_inplace
    self._query.add_q(Q(*args, **kwargs))
  File "django/db/models/sql/query.py", line 1648, in add_q
    clause, _ = self._add_q(q_object, can_reuse)
  File "django/db/models/sql/query.py", line 1680, in _add_q
    child_clause, needed_inner = self.build_filter(
  File "django/db/models/sql/query.py", line 1505, in build_filter
    return self._add_q(
  File "django/db/models/sql/query.py", line 1680, in _add_q
    child_clause, needed_inner = self.build_filter(
  File "django/db/models/sql/query.py", line 1505, in build_filter
    return self._add_q(
  File "django/db/models/sql/query.py", line 1680, in _add_q
    child_clause, needed_inner = self.build_filter(
  File "django/db/models/sql/query.py", line 1528, in build_filter
    lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
  File "django/db/models/sql/query.py", line 1335, in solve_lookup_type
    _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
  File "django/db/models/sql/query.py", line 1813, in names_to_path
    raise FieldError(

I have verified the bug fix in stage

This was deployed in v2026.04.08. Haseeb, can you verify it in prod?

Flags: needinfo?(hafzal)

Verified in prod. The fix looks good to me.

Flags: needinfo?(hafzal)
Status: NEW → RESOLVED
Closed: 13 days ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: