Changes between Initial Version and Version 1 of Ticket #36926, comment 6
- Timestamp:
- Feb 23, 2026, 12:22:41 PM (11 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #36926, comment 6
initial v1 1 1 Yes, that is exactly right. When a field is a direct BooleanField on the model for example 2 {{{ 2 {{{#!python 3 3 list_display = ['is_active'] 4 4 }}} … … 7 7 This is handled in display_for_field() in django/contrib/admin/utils.py: 8 8 9 {{{ 9 {{{#!python 10 10 elif isinstance(field, models.BooleanField): 11 11 return _boolean_icon(value) … … 13 13 14 14 15 The bug is specifically about **related field traversal**. When you write 'profile__verified' instead of 'verified', Django cannot find the field via _get_non_gfk_field() because the name contains '__', so it falls back to f=None. With f=None, it calls display_for_value() instead of display_for_field(), which simply returns str(value)→ "True"/"False".15 The bug is specifically about **related field traversal**. When you write `profile__verified` instead of `verified`, Django cannot find the field via `_get_non_gfk_field()` because the name contains `__`, so it falls back to `f=None`. With `f=None`, it calls `display_for_value()` instead of `display_for_field()`, which simply returns `str(value)` → "True"/"False". 16 16 17 This fix closes that gap: when traversing a relation path with '__', we resolve the final field using get_fields_from_path() and pass it as f, so display_for_field()is called correctly and the same automatic boolean icon behavior that exists for direct fields is preserved.17 This fix closes that gap: when traversing a relation path with `__`, we resolve the final field using `get_fields_from_path()` and pass it as `f`, so `display_for_field()` is called correctly and the same automatic boolean icon behavior that exists for direct fields is preserved. 18 18 19 Regarding your question about plain text being useful, No, there is no case where a BooleanField should display as plain text in the changelist. Django already makes this decision unconditionally for direct BooleanFields, the fix simply extends that same existing behavior to related field traversal for consistency.19 Regarding your question about plain text being useful, No, there is no case where a `BooleanField` should display as plain text in the changelist. Django already makes this decision unconditionally for direct `BooleanField`s, the fix simply extends that same existing behavior to related field traversal for consistency.